Importing from Bitbucket to Github


I have a habit of betting on the wrong horse. I used Bitbucket from way back when, largely because it supported Hg. Now the world has long since settled on Git, I started using it as such on Bitbucket, while also tracking projects on GitHub. This weekend, I decided I'd merge the two to make life easier.

The git-neutral way to achive this is setting a new remote URL for your existing Bitbucket repo, and pushing to it. For example:

$ cd ./bitbucket-repo/
$ git remote set-url --push origin
$ git push --mirror

According to past screenshots people had made, GitHub used to sport an Import code button in their repo creation screen, but no such button exists now.

Today though I learned the relatively hidden GitHub Importer still exists. It can take the URL of an existing SVN, Hg, TFS or Git repo as a source, then creates a new repo with full commit history. Your Bitbucket repo would need to be public for this to work.

I haven’t tried this with branches, or repos with wiki pages etc, so YMMV.

Author bio and support


Ruben Schade is a technical writer and IaaS engineer in Sydney, Australia who refers to himself in the third person in bios. Wait, not BIOS… my brain should be EFI by now.

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite cloud infrastructure provider.

You can leave me a comment by contacting me, and I might publish your thoughts. Please read the FAQs first though.

If you found this post helpful or entertaining, you can shout me a coffee or buy some silly merch. Thanks!