How to migrate from Bitbucket to GitHub

Robert Chanphakeo

We have been happily using Bitbucket over the last years. But as more and more tools offer better out-of-the-box integration with Gitub, we increasingly move our repositories over to Github.

Here are the steps to move a Git repository:

Step 1: Create Github repository

First, create a new private repository on Github.com. It’s important to keep the repository empty, e.g. don’t check option Initialize this repository with a README when creating the repository.

Step 2: Move existing content

Next, we need to fill the Github repository with the content from our Bitbucket repository:

  1. Check out the existing repository from Bitbucket
$ git clone https://USER@bitbucket.org/USER/PROJECT.git

2. Add the new Github repository as upstream remote of the repository checked out from Bitbucket

$ cd PROJECT
$ git remote add upstream https://github.com:USER/PROJECT.git

3. Push all branches

$ git push upstream master
$ git push --tags upstream

Step 3: Clean up old repository

Delete the bitbucket repository.

Robert Chanphakeo

Written by

entrepreneurship, technology, innovation, and start-ups.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade