📝 Git & GitHub

Migrating from GitLab to GitHub

P
Author
Pyland
📅
Published
06.05.2026
⏱️
Reading time
1 min
👁️
Views
137
📊
Level
Article

GitHub will automatically transfer the code and all history.

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

📝

Your First Git Commit

Git will create a hidden .git folder — everything is stored there.

📅 30.06.2026 👁️ 110
📝

Git Hosting Platforms

GitHub, GitLab, Bitbucket — key differences and recommendations.

📅 06.05.2026 👁️ 306
📝

What Is a Git Commit and Why Do You Need It? 📸

A commit is a saved snapshot of your project at a specific point in time...

📅 06.05.2026 👁️ 167

Did you like the article?

Subscribe to our updates and receive new articles first. Grow with PyLand!