How to completely migrate from Gitlab to Github: Part 1

How to completely migrate from Gitlab to Github: Part 1

We are currently trying to move from Gitlab to Github. There are a couple of reasons and the decisions seem to depend on whether it is possible to migrate all the data from Gitlab to GitHub i.e. repo, MRs, Issues from Gitlab, Comments on MRs, and Issues, wiki, binary content linked in MR's and Issues, etc. This part would be focused on migrating repository and metadata related to the repositories.

The tool

The next part was finding a tool to make it easy to migrate this automatically as our repo had 3000+ MRs and Issues combined. Doing it manually would be impossible. Now comes the tool node-gitlab-2-github.

This repo looks promising as I was able to migrate a small personal project from gitlab.com to github.com.

Pre-requisite

  1. Create a user with restricted access to your GitLab. Create a token for this user. This user can have access to only read the repos from Gitlab. (Optional but always good for fine-grained control and security)

  2. Create a user in Github. Create a token for this user with the repo access. This user will need write access.

  3. If you want to store the attachments or binary data that is included in the MR or PR then.

    1. Create an AWS programmatic user with permission to write to S3.

    2. Create a S3 bucket. Objects in buckets should have public access. Docs to follow this.

  4. Follow the steps in node-gitlab-2-github.


For POC I managed to migrate one of my personal repos from Gitlab to Github. This repo only had 4 MRs and 3 Issues.

Observations

  • The summary of total MRs and Issues at the start is good.

  • If a merged MR source branch is deleted the tool creates a new Issue and adds the commit sha for reference.

  • Resuming the migration, duplicate MRs and Issues are created.

  • MRs are numbered the same as they are on Gitlab. But if one of the issue fails for some reason while migrating the numbers are messed up. So interlinking of issues might not work well if there are intermediate errors.

  • If the tool fails to create MR or Issue it tries to create a placeholder issue with the title [PLACEHOLDER] - for issue #41

In short, the node-gitlab-2-github does a good job of migrating issues and MRs.

Pending questions

  • Are the code review comments synched with the code lines or they are just available in the overview?

  • What is the throttling on GitHub API?

  • How many issues/MRs can I migrate in an hour?

  • How long does it take to complete the migration on 2500+ issues and MRs?

  • How the links between Issues and MRs is done by this tool?

I'll try to migrate a large repo with 2500+ Issues and MRs and update it in the future blog.

Observations in Part 2

Did you find this article valuable?

Support Pranav Padmasali by becoming a sponsor. Any amount is appreciated!