Please make sure you read the safety information before proceeding: there's an edge case that could expose your private repos.
Before starting make sure you can clone your Bitbucket repos by running on one of them
> git clone git@bitbucket.org:${USERNAME}/${REPONAME}.git
If this doesn't work please fix it before continuing.
-
Copy
envto.env -
Go to
https://bitbucket.org/account/user/{USERNAME}/app-passwordsand create an app password with read on repositories as the only permission -
Fill your
.envfile with the relevant bitbucket data -
Go to
https://github.com/settings/tokens/newand generate a new token with all the repo permissions. -
Fill your
.envfile with the relevant github data
You'll need node and yarn installed
> yarn && yarn start
If you wanted to change the email you used in bitbucket during the migration (or the name of your user) you could also fill the OLD_EMAIL, CORRECT_NAME, CORRECT_EMAIL in the .env file. More information about this option
- The Github repos are always created as private.
- If a Github repo with the same name exists and has existing commits is left untouched.
- If a Github repo with the same name and no previous history exists, the Bitbucket content gets pushed WITHOUT checking wether is private or not.
- The Bitbucket repos don't get deleted.
I haven't tried it with a repo having multiple branches.