Copy Bitbucket repo to GitHub

Whenever possible, use GH’s “Import repository” feature.

The import feature doesn’t always work, though. In my experience, I tried to import a repo and it failed with a generic message. I had to contact GH support to ask for help. They told me my repo had a large file (>100MB), which couldn’t be added to GH directly. I had to either remove the file or store it in GH LFS. In this case, one of the CLI methods below are needed:

CLI: Copy the master branch only (OK)

⚠️ Caution: This method only copies the master branch, not others and not tags.

$ cd $HOME/Code/repo-directory
$ git remote rename origin bitbucket
$ git remote add origin
$ git push origin master
$ git remote rm bitbucket

CLI: Copy more than master (Better)

$ # create a new public repo "tarfu/fubar" on Github
$ git clone
$ cd fubar
$ git remote add
$ git push upstream master; git push upstream develop; # add more branch pushes as necessary
$ git push --tags upstream

CLI: Copy everything (Best)

ℹ️ Note: This method uses --mirror to copy all branches, tags, etc.

$ git clone --mirror
$ cd aiida_core.git
$ git remote set-url --push origin
$ git push --mirror

Also helpful: Copy issues