Skip to content

Instantly share code, notes, and snippets.

View AndreYonadam's full-sized avatar

Andre Yonadam AndreYonadam

View GitHub Profile
@AndreYonadam
AndreYonadam / migrate-git-repos.md
Created November 8, 2021 03:05 — forked from dbirks/migrate-git-repos.md
Script to fully migrate git repos, including all tags and branches

Migrate git repos script

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