๐Ÿ“ Git & GitHub

Migrating from GitLab to GitHub

P
Author
PyLand Team
๐Ÿ“…
Published
06.05.2026
โฑ๏ธ
Reading time
1 min
๐Ÿ‘๏ธ
Views
454
๐Ÿ†
Level
Expert

A Git repository can be moved to GitHub with its history, branches, and tags, but GitLab-specific data and settings require a separate review.

Method 1: GitHub Import (easiest)

  1. Go to github.com/new/import
  2. Paste the GitLab repository URL
  3. For private repos, enter a GitLab Personal Access Token:
    - GitLab โ†’ Settings โ†’ Access Tokens โ†’ scope read_repository
  4. Choose the repository name on GitHub, Public/Private
  5. Click Begin import

GitHub will automatically transfer the code and all history.

Method 2: Git mirror (full control)

# 1. Clone from GitLab
git clone --bare https://gitlab.com/username/project.git

# 2. Mirror push to GitHub
cd project.git
git push --mirror https://github.com/username/project.git

# 3. Remove the temporary folder
cd ..
rm -rf project.git

--bare โ€” Git data only, no working files. --mirror โ€” copies all branches, tags, and refs.

Method 3: Via GitHub Desktop

  1. File โ†’ Clone Repository โ†’ URL โ†’ paste the GitLab HTTPS URL
  2. After cloning: Publish repository

What Transfers

Transfers Does NOT transfer
Code Issues
Commit history Merge Requests
All branches CI/CD Pipelines
Tags Wiki
Commit authors Labels, Milestones

CI/CD: GitLab โ†’ GitHub Actions

Before (.gitlab-ci.yml):

test:
  image: python:3.12
  script:
    - pip install -r requirements.txt
    - pytest

After (.github/workflows/ci.yml):

name: CI
on: [push, pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: '3.12'
      - run: pip install -r requirements.txt
      - run: pytest

Update README Badges

# Before (GitLab)
[![pipeline status](https://gitlab.com/username/project/badges/main/pipeline.svg)]

# After (GitHub)
![CI](https://github.com/username/project/actions/workflows/ci.yml/badge.svg)

Update Remote for Team Members

git remote set-url origin https://github.com/username/project.git
git fetch

Migration Checklist

  • Created repository on GitHub
  • Transferred code (git push --mirror)
  • Set up GitHub Actions (replaced .gitlab-ci.yml)
  • Updated README (badges, links)
  • Configured branch protection
  • Updated CI/CD secrets
  • Notified the team to update their remote
  • Made the GitLab repository read-only

Your reaction to the article

๐Ÿ’ฌ Comments (0)

๐Ÿ” Sign in to leave a comment
๐Ÿšช Login
๐Ÿ’ญ

No comments yet

Be the first to share your opinion about this article!

๐Ÿ”— Similar

Similar articles

Continue learning with these materials

๐Ÿ“

Undo and Revert in GitHub Desktop: Fix Mistakes Wโ€ฆ

A commit is not a point of no return. GitHub Desktop lets you rebuild a...

๐Ÿ“… 16.07.2026 ๐Ÿ‘๏ธ 358
๐Ÿ“

History, Diffs, and Web Commits on GitHub

GitHub lets you read repository history, inspect individual commit diffs, view the history of one...

๐Ÿ“… 16.07.2026 ๐Ÿ‘๏ธ 311
๐Ÿ“

Your First Git Commit

Your first commit starts with initializing a repository, configuring the author identity, and selecting the...

๐Ÿ“… 30.06.2026 ๐Ÿ‘๏ธ 341
๐ŸŽ“ Continue learning

Courses that cover this material

Visit the course to apply this material in practice.

Git & GitHub Desktop: Teamwork Without the Pain Open course curriculum