Last active
March 19, 2021 16:34
-
-
Save M507/169d10e31f0c7e1e726aa532e58e3c9c to your computer and use it in GitHub Desktop.
Backup public repositories
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
your_gitlab_profile=gitlab-example.com:username | |
github_link=$1 | |
folder_name=$(echo $github_link | awk -F'/' '{print $NF}' | rev | cut -c5- | rev) | |
git clone $github_link $folder_name | |
cd $folder_name | |
rm -rf .git/ | |
git init | |
git add * | |
git commit -m "Backup script" | |
git remote add origin git@$your_gitlab_domain/$folder_name.git | |
git push -u origin master | |
cd .. | |
rm -rf $folder_name | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment