Version Control System (VSC)

Import repo to Bitbucket Cloud: How to import your project from Bitbucket Server or Bitbucket Cloud to GitLab

bitbucketexportimport

A code repository is a file archive and repository hosting facility that stores source code and technical documentation of development projects. It’s available for public and private access. This tool is widely used by developers, software engineers, or programmers to work on software or website development projects, etc. GitLab Inc. is the open-core company that provides GitLab, the DevOps software that combines the ability to develop, secure, and operate software in a single application. Bitbucket Server (formerly known as Stash) is a combination Git server and web interface product written in Java and built with Apache Maven. It allows users to do basic Git operations (such as reviewing or merging code, similar to GitHub) while controlling read and write access to the code. Here are some related guides: How to unregister a GitLab Runner, how to install, register, and start GitLab Runner on Windows, how to uninstall GitLab from your Windows device, and Deploying and using Windows containers with Gitlab CI.

I would say GitLab and GitHub have the best user interface, and most developers prefer GitHub because it's more popular. However, teams using Jira benefit from having seamless integrations with the Atlassian ecosystem. GitLab has Continuous Integration/Continuous Delivery (CI/CD) and DevOps workflows built-in. GitHub enables you work with the CI/CD tools of your choice, but you'll need to integrate them by yourself. Bitbucket’s code hosting is solid, but the web experience is quite lacking. The code search is not supported, nor the File Finder, and this could be the reason you want to migrate amonst other things.

Import your project from Bitbucket Server to GitLab

The Bitbucket Server importer does not work with Bitbucket Cloud. The Bitbucket Cloud importer for that, and at the end of this guide, I will be discussing how you can import a repo from a different repository to Bitbucket Cloud. Before imports into the Bitbucket server can be successful, a Bitbucket administrator will have to ensure import success is enabled. Kindly follow these steps to have it done. In the Bitbucket Server in the Admin area,
– Click on Settings
– On General,
– Click on Visibility and access controls and
– Finally Import sources.

The following can be imported to the BitBucket Server. When importing, repository public access is retained. If a repository is private in Bitbucket, it’s created as private in GitLab as well.

  • Repository description
  • Git repository data
  • Pull requests
  • Pull request comments

Below are the steps to import your projects into GitLab. Sign in to GitLab, and Select New project

Screenshot-2022-04-27-at-19.49.23

This will open the Create new project window. Select Import project as shown below.

Screenshot-2022-04-27-at-19.50.39

Select Bitbucket Server. As you can see, you can import projects from a wide range of repositories

Screenshot-2022-04-27-at-19.52.27

Enter your Bitbucket Server URL and your personal access token in order to access your Bitbucket account as shown in the image below. Upon entering ur personal access codes, and granting GitLab access to your Bitbucket account. You could click on List your BitBucket Server Repositories in order to select one.

Screenshot-2022-04-27-at-19.54.28

Select the projects to import, or import all projects. You can filter projects by name and select the namespace for which to import each project.

imortrepo56

As you can see below, I have selected a project to import from Bitbucket.

importselectedrepo

As you can see, the project import is pending and currently being imported.

importingstatus

Finally, the image below shows a successful import of our project from Bitbucket Server to GitLab.

importedrepo

Import your project from Bitbucket Cloud to GitLab

This process is different than importing from Bitbucket Cloud. Import your projects from Bitbucket Cloud to GitLab with minimal effort. The Bitbucket importer can import:

  • Repository description
  • Git repository data
  • Issues
  • Issue comments
  • Pull requests
  • Pull request comments
  • Milestones
  • Wiki

Log on to Bitbucket Cloud to start the project import. When importing, it is worth noting that references to pull requests and issues are preserved. Also, the repositories with public access will be retained. If a repository is private in Bitbucket, it’s created as private in GitLab as well. To proceed with this import, you will have to sign into GitLab.

On the top bar, select New (), and select New project/repository.

Screenshot-2022-04-27-at-19.49.23

Next, you will have to select Import project.

Screenshot-2022-04-27-at-19.50.39

Select Bitbucket Cloud. As you can see, you can import projects from a wide range of repositories.

Screenshot-2022-04-27-at-20.05.44

Grant GitLab access to your Bitbucket account as shown in the image below. Upon granting access, a list of your BitBucket Cloud Repositories in order to select one.

Screenshot-2022-04-27-at-20.08.04

Select the projects that you would like to import or import all projects. You can filter projects by name and select the namespace each project will be imported.

Screenshot-2022-04-27-at-20.12.21

When importing, if the following error is prompted, here is how to resolve the issue: “Importing the project failed: Project namespace path can contain only letters, digits, ‘_’, ‘-‘ and ‘.’. Cannot start with ‘-‘, end in ‘.git’ or end in ‘.atom’, Path can contain only letters, digits, ‘_’, ‘-‘ and ‘.’. Cannot start with ‘-‘, end in ‘.git’ or end in ‘.atom’, Path must not start or end with a special character and must not contain consecutive special characters.”

As you can see, the state will change to pending and then complete.

Screenshot-2022-04-27-at-20.20.16

As you can see, the migration to GitLab has succeeded (complete).

Screenshot-2022-04-27-at-20.20.38

Now, let’s click on the project to access it and to see if it was successfully migrated. As you can see from the image below, it was. Also, under the activities, you will see an entry of the user that imported a project.

Screenshot-2022-04-27-at-20.24.27

Import to Bitbucket Cloud from a different Repository

Bitbucket provides an importer to grab a repository. This importer works if you have your code in CodePlex, GitHub, Google Code, SourceForge, Subversion, or another Git-based hosting site. However, if your hosting site doesn’t fall into one of these sources or you don’t have a URL to enter, you must convert your code to Git.

To import into Bitbucket Cloud, kindly follow the steps below. Access your Bitbucket account and click on import repository from the Create a new repository page.

Screenshot-2022-04-27-at-19.14.12

Select the Source of the code you want to import. Depending on the Source, the system asks you to provide some more information. Enter a Name for your new repository, Uncheck This is a private repository if you want the repository to be public, Select the Repository type,

Note: If your organization has configured a personal access token to retrieve the repository via your Git client or the command line, then you may need to use it in lieu of your username/password within the Bitbucket importer.
Screenshot-2022-04-27-at-20.50.38

If you wish to enter a description and allow forking etc, expand Advanced settings and fill out the rest of the page if necessary. When you are done, hit the Import repository button.

Screenshot-2022-04-27-at-20.54.06

I hope you found this blog post helpful. If you have any questions, please let me know in the comment session.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x