Last active
January 11, 2019 07:34
-
-
Save mhulse/6e32f1a5b403ec8438186f52e9bfc3c6 to your computer and use it in GitHub Desktop.
Revisions
-
mhulse revised this gist
Jan 11, 2019 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,7 @@ #!/usr/bin/env bash # This script assumes you have your ssh keys setup for Bitbucket and GitHub. # It also assumes you have created the repos on GitHub already and the URL slugs are an exact match. # Also, this script will barf if you try to transfer an empty repo. # Note that this code does not transfer wikis, downloads or issues. # Also note, you may have to turn on QOS upload speed limiting so your router -
mhulse created this gist
Jan 11, 2019 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ #!/usr/bin/env bash # This script assumes you have your ssh keys setup for Bitbucket and GitHub. # Also, this script will barf if you try to transfer an empty repo. # Note that this code does not transfer wikis, downloads or issues. # Also note, you may have to turn on QOS upload speed limiting so your router # doesn’t freak out; I limited my upload bandwidth to 2Mbps. # Don’t forget to `chmod u+x <this file>.sh` in order to execute it via `./<this file>.sh`. declare -r bitbucket_user= declare -r github_user= declare -r xfer_from=bitbucket.org declare -r xfer_to=github.com # Explicitly declare a variable (this is better than implicit): declare -a repos=( "foo" "baz" "bar" "other" ) for i in "${repos[@]}"; do echo Transfering repo: "$i" git clone --bare git@${xfer_from}:${bitbucket_user}/${i}.git cd ${i}.git || exit git push --mirror git@${xfer_to}:${github_user}/${i}.git cd - || exit done # Gracefully Exit program: exit 0