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 https://github.com/user/repo
$ 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.