5 Simple steps to transfer github repository

Transfer repository from Github to Bitbucket

In this article, I am going to demonstrate how to transfer your private repositories from Github to bitbucket account.
Transferring repo’s from GitHub to bitbucket is a very simple process. You just need to follow three or four steps. You will get the repo under bitbucket account.

Reason to transfer repository

First, we understand why we transfer our repository because all we know GitHub provide very awesome service then what is the reason?

I will tell you why I transferred my repo to bitbucket. The situation was we have Git Hub account with limited private repository access which means we have limitations to create a private repository on one of our Git Hub accounts. We had a requirement to create a new private repo on Git hub. We decided to move one of our not so used repositories to bitbucket account.
Another option which I have is to upgrade my GitHub plan which also cost effective. Git Hub charges you per repositories and for the single repository which is going to handle by just one or two developers upgrading plan does not make sense. Instead of git hub, bitbucket provides Instead of git hub, bitbucket provides

Instead of git hub, bitbucket provides a more feasible option. When it comes to cost means bitbucket not charge you for repositories. You have created a repo on bitbucket. They will charge you on no. of users rather than repositories. Also, bitbucket private repo is free for up to 5 users.

Now think why we need to pay per repositories when we have a good option to pay per user. Most of the time we have added only three or four developers on any project or repository. If you have a big team then creating a repo on GitHub is a good option.

So when I went through above situation, I realize that I should write about this and should share on an own blog. It will be helpful to understand the process of transferring repositories.

One more option to save extra bucks. You can also setup your own gitlab server if you have a small firm and you are motive is to save money. If you don’t use more than 10 repositories then this is the best option for you to save money as well as faster access to your repositories.

Read: How to setup own Gitlab Server?

Now come to the point if you are in any above situation then follow below 5 simple steps.

Step 1: Login to Bitbucket Account.

First login to your bitbucket account using your bitbucket credentials.

bitbucket login

Step 2: Import Repository

Once you logged into the bitbucket account, check on the top menu you will see the “Repositories” tab under this tab select “Import Repository

Repositories-->Import Repository

bitbucket

From Source, you need to select “Git”  then add the URL of Github Repository and select “Require Authentication”. In Authentication you need to provide username and password of your Github Account.

bitbucket

Step 3: Copy URL from Github

As per above step, you need to give the URL of GitHub repository which you can copy from your GitHub account. Now go to the GitHub account and select repository which you want to transfer.
Click on Download button and copy URL then paste it in bitbucket.
Refer below screenshot.

Github

Step 4: New Repository

Once filled all the necessary information like URL, credentials come below and go to the fields under the New repository automatically filled in including name.

Note: if you already have a repo with same in bitbucket then you will have to use some other name for your repository.
Keep other settings as it is and click on “Import Repository”.

bitbucket3

That’s it. Now you will have your Github repo under the bitbucket with all the settings, logs etc. as it is on bitbucket.

Step 5: Remove Github Repository

Once you confirm all your repository data transferred on bitbucket account then remove the transferred repo from Github Account.
Repository-->Settings-->Delete Repository

github repo

Step 6: Change Origin on local machine

Make sure you will also change the URL of the repository on your local machine or on the server.

Check the previous URL using : git remote -v [This will show you that the repo origin still on github]
Eg.
origin https://USERNAME@github.com/USERNAME/REPONAME.git (fetch)
origin https://USERNAME@github.com/USERNAME/REPONAME.git (push)

Change this origin with bitbucket URL which should be like git@bitbucket.org:USERNAME/REPONAME.git

These are the 5 simple steps to transfer the repository from GitHub to bitbucket.

I hope you like the post if you have any kind of queries regarding the post. Please comment your queries and suggestion under the comment box.
 
Thank You 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *