Gitlab to Github

Method 1: Using the GitHub Repository Importer Tool

Thanks to GitHub‘s importer tool, you can easily migrate your project hosted on another version control system like GitLab and automatically import it to GitHub.

Here’s how to go about it:

  1. In the upper-right-hand corner of any page, click +. Follow this up by clicking on Import repository.

  2. Under the Your old gitlab repository’s clone URL option, type the URL of the project you want to import.

  3. Screenshot of GitHub repository importer tool with box highlighted where you type URL of your old repository's clone URL

  4. Select either your personal account or an organization to own the repository. Once that’s done, type a name for the repository on GitHub.

  5. Next, specify whether the new repository will be public or private. You can check out this article to learn more about repository visibility.

  6. Box where you specify if you want your new repository to be public or private

  7. Click on Begin import.

  8. If your old project was password-protected, type the login information for that specific project. Select Submit.

  9. You may also have to choose the project you want to import if you have multiple projects hosted at your old project’s clone URL. If that’s the case, select the right project and click Submit.

Method 2: Using the Command Line

Before we get down to the steps, make sure you know your GitHub and Gitlab username and the clone URL's for the external repository.

The following is how you import a Git repository using the command line.

  1. Create a new repository on GitHub. This will be the new repository where you will import your external git repository from gitlab.

  2. Ensure you Know the Repository URL.

  3. Open the Local Repository ( i.e Gitlab , which you want to migrate ) and check the remote details.

  4. List the configured remote repositories:

The default origin remote is pointing to GitLab. Let’s point it to GitHub

Open the imported project on GitHub and copy its clone URL as if you were going to clone it:

5. hange the origin remote URL:

If you list the remotes again, you’ll see that the default origin remote now points to GitLab as well as Github.

.

Last updated