Skip to content

From GitLab to GitHub - Overview

Migrating a repository from GitLab to GitHub involves exporting your code and history, setting up a new GitHub repository, and carefully transferring issues, CI/CD pipelines, and permissions. The process is straightforward for code but requires extra steps for workflows and collaboration data.

List of References (Click to expand)
Aspect GitLab → GitHub Migration Notes
Code & History Easy with git clone --mirror and git push --mirror.
Issues Requires API tools or manual import; labels may need rework.
CI/CD Pipelines must be rewritten for GitHub Actions.
Wiki Can be cloned/pushed separately as another repo.
Permissions Must be recreated manually in GitHub.
Integrations GitHub offers broader ecosystem (Actions, Copilot, Codespaces).

Note

Preparation: - Audit your GitLab repo: Check branches, tags, issues, merge requests, and CI/CD pipelines. - Decide scope: Are you migrating just the code, or also issues, wiki, and pipelines? - Access setup: Ensure you have admin rights on both GitLab and GitHub.

Repository Migration (Code + History)

E.g Repo of 4.2 GB:

image

https://github.com/user-attachments/assets/5996e84e-f50b-4670-b6e5-de8310421c21

History example:

https://github.com/user-attachments/assets/fffbbce1-8a48-49f7-a8d8-96da6d9c433e

  1. Clone your GitLab repository:

git clone --mirror https://gitlab.com/username/repo.git
- --mirror ensures all branches, tags, and refs are included.

E.g

image

  1. Create a new repository on GitHub (empty).

    https://github.com/user-attachments/assets/ba8b1a16-4949-493c-bac2-4a63ba59b2f9

    E.g:

    image

  2. Push the mirrored repo to GitHub:

    cd repo.git
    git push --mirror https://github.com/username/repo.git
    

E.g:

image

image

At this point, your code and commit history are fully migrated.

E.g:

image

https://github.com/user-attachments/assets/21d82423-d51b-493c-b921-0e437c13e580

Issues and Comments

Note

Some metadata (labels, assignees) may need manual adjustment.

  • GitHub does not natively import GitLab issues.
  • Options:
  • Third-party tools: e.g., gitlab2github or Python scripts that use GitLab/GitHub APIs.
  • Manual export/import: Export issues from GitLab as JSON/CSV, then use GitHub’s API to recreate them.

CI/CD Pipelines

  • GitLab CI uses .gitlab-ci.yml; GitHub uses GitHub Actions (.github/workflows/*.yml).
  • Migration requires rewriting pipeline definitions:
  • Map GitLab jobs to GitHub Actions workflows.
  • Replace GitLab-specific runners with GitHub-hosted runners.
  • Test workflows thoroughly after migration.

Permissions and Collaboration

  • Recreate teams and permissions in GitHub.
  • GitHub offers Organizations, Teams, and Role-based access control.
  • If migrating multiple repos, consider using GitHub Enterprise migration tools.