written by
Taric Andrade

Moving Repository from Bitbucket to GitHub

Technology 1 min read

I’m working as a Volunteer in a new product/project, ProInstinct, and we needed to move our repositories from Bitbucket (private) to Github (private). Why did we need to move?

Very simple, our team of volunteer developers has grown, and Bitbucket only allows five free members on the team. With the recent move by Github to allow free private repositories and unlimited members, the decision to change was straightforward.

I was a bit uncertain about the sequence of git commands that I should perform without having any problem. After brief research and a few tests with a dummy repository (always test with dummy code first), I realize that it is relatively safe and comfortable.

The first step to ensure that you do not lose all or part of your hard work is to merge all branches. You should have only one branch, master, to do this migration. Clone the repository to your hard drive.

You probably already have your GitHub account, now create your new repository on Github, and save the URL, and follow these steps:

cd $repository
git remote rename origin bitbucket
git remote add origin https://github.com/{new repository}.git
git push origin master

This process can take a while; it will depend on the amount of file and size and your internet connection. Once the process is finished, check that your code is all in our repository. Once you are satisfied with sending to GitHub, you can delete the old remote by issuing:

git remote rm bitbucket

I spent more time researching and studying how to transfer than doing. Do not forget the most sensitive part of this process are the branches; if you have several branches, the transfer will become more laborious.

But for a single branch, it is straightforward in the end.

dadpreneur github bitbucket developer