I used this for migrating git repos from Bitbucket to Github. It uses git's --mirror
flag for cloning and pushing to also transfer all tags and branches.
It would be helpful to have SSH keys set up on both ends. Then all you should have to do is to make sure the hardcoded orgname
is set to the appropriate one for both the source and destination.
Once I migrated repos, I used this to replace my origin url locally (assumes using ssh):
sed -i s/bitbucket.org:orgname/github.com:orgname/g .git/config
To do this in mass, I put each repo name on its own line in a file named repo-list
, and looped through them with:
for repo in $(cat repo-list); do ./migrate-git-repos.sh $repo; done
Happy migrating! 🐦
Use GitHub CLI