How to Move a Private Repository from Bitbucket to Github

Ronny Roeller
Nov 23, 2015 · 2 min read

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 private Git repository:

Step 1: Create Github repository

First, create a new private repository on 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

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

$ git remote add upstream

3. Push all branches (below: just master) and tags to the Github repository:

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

Step 3: Clean up old repository

Finally, we need to ensure that developers don’t get confused by having two repositories for the same project. Here is how to delete the Bitbucket repository:

  1. Double check that the Github repository has all content
  2. Go to the web interface of the old Bitbucket repository
  3. Select menu option Setting > Delete repository
  4. Add the URL of the new Github repository as redirect URL

With that, the repository completely settled into its new home at Github. Let all the developers know!

That’s it.

Want to learn more about coding? Have a look to our other articles.

NEXT Engineering

Tech lessons learned while making innovation smart, simple…

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store