How to import your company's private repository from Bitbucket into GitHub
For a long time, Bitbucket has been a very attractive option for software hosting and version control because it offered a free plan for unlimited private repositories for a team of up to 5 collaborators. Now that GitHub provides a free plan for unlimited private repositories and unlimited collaborators, you have a chance to use it to work on big projects with a big team.
In fact, GitHub is increasingly becoming attractive because it offers issue tracking, project management boards, group milestone tracking, team discussions and organization management in the free plan.
I was working on a project, Fourth Profile, and I realised that Bitbucket's collaborator limit is not per repository but per account (See Atlassian discussion). It means that if you have five (5) users accessing any repository in your account, then you will not be able to add any more collaborators even to a repository that has two (2) collaborators. If you try to invite a user, the user will see the following message when they try to join;-
The owner of this repository is already at their plan limit and will need to upgrade before adding more users.
Gitlab is another alternative to GitHub and Bitbucket, which claims to offer a complete DevOps platform, delivered as a single application.
In this post, I will show you how to migrate your company's private repository from Bitbucket to GitHub.
- A GitHub account. If you do not have one, you can create one here.
- A Bitbucket account with an existing repository, which you want to migrate to GitHub.
We will follow the following steps to migrate your company's repository from Bitbucket to GitHub.
Step 1: Create a GitHub organization
Click on a plus (+) sign at the top left corner to create an organization. The organization is the name of your company and you can select a free plan as shown in the screen recording below:-
Notice that you are asked to enter your GitHub account password for you to complete the organization creation process. Team members can optionally be added at this step.
After your organization is created, you will fill a small questionnaire, which is essential, and it allows GitHub to know your organization better.
You are now ready to add a repository in your organization.
In your organization, you can create/add as many repositories as possible.
Step 2: Create an empty repository
Click on a plus (+) sign at the top left corner to create a repository.
Fill in the details of your repository as shown on the screenshot below. Because you are creating a repository for your organization, it will mostly be a private repository.
Step 3: Importing your repository
Select and click on the repository you just created, and you will be given three (3) options, which you can use to add content to it as shown in the screenshot below;-
Because we already have our code in Bitbucket, we will take the last option, which is 'Import code'.
Click on 'Import code', and you will see the interface shown below.
In the "Your old repository's clone URL" text input, put the repository's clone's HTTPS link obtained from Bitbucket. See screenshot below.
Notice that you do not include the "git clone" part. After you enter the URL, click on "Begin import".
You will be prompted to enter your credentials to the old repository. In this case, enter your Bitbucket's username and password and click 'Submit'.
If your credentials are correct, GitHub will start preparing your new repository.
When the process of importing and preparing your new repository is done, GitHub will let you know. See screenshot below.
Note that this process may take a few minutes to complete.
We successfully migrated an organization's private repository from Bitbucket to GitHub.
I hope you were successful as well.
Happy coding :)