📝 Git & GitHub

Migrating from GitLab to GitHub 🚚

0
Author
04e5cc8b-58ac-4bdc-bdee-661bbb
📅
Published
06.05.2026
⏱️
Reading time
4 min
👁️
Views
46
🌱
Level
Beginner

Moving from GitLab to GitHub? Here’s a complete guide to migrating your projects!

Why migrate?

GitLab excels at:
- Powerful built-in CI/CD
- Self-hosted deployments
- DevOps tooling

GitHub is better for:
- Portfolio visibility
- Open-source community
- GitHub Actions
- Integrations

Method 1: Import via GitHub (EASIEST)

Steps:

  1. Go to github.com/new/import
  2. Paste the GitLab URL:
    https://gitlab.com/username/project
  3. If the repo is private → enter your GitLab Personal Access Token:
    - GitLab → Settings → Access Tokens
    - Create a token with the read_repository scope
  4. Choose a repository name on GitHub
  5. Select Public/Private
  6. Click Begin import

✅ GitHub will migrate everything automatically!

Method 2: Git mirror (full control)

Commands:

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

# 2. Enter the directory
cd project.git

# 3. Create the repository on GitHub.com

# 4. Mirror-push
git push --mirror https://github.com/username/project.git

# 5. Cleanup
cd ..
rm -rf project.git

Done! Full history now lives on GitHub.

Method 3: Via GitHub Desktop

  1. Clone the GitLab repository:
    - File → Clone Repository → URL
    - Paste the GitLab HTTPS URL
  2. After cloning: click Publish repository
  3. Done!

What gets migrated automatically?

✅ Migrated

  • All code
  • Commit history
  • All branches
  • Tags
  • Contributors (authors)

❌ NOT migrated

  • Issues
  • Merge Requests (→ Pull Requests)
  • CI/CD Pipelines
  • Wiki
  • Milestones
  • Labels

Post-migration: adapting

1. GitLab CI → GitHub Actions

Before (.gitlab-ci.yml):

test:
  script:
    - npm install
    - npm test

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

name: CI
on: [push, pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - run: npm install
      - run: npm test

2. Migrating Issues (if needed)

Use the tool: github.com/piceaTech/node-gitlab-2-github

npm install -g github-cli gitlab-2-github

g2g migrate \
  --gitlabUrl https://gitlab.com \
  --gitlabToken YOUR_GITLAB_TOKEN \
  --githubToken YOUR_GITHUB_TOKEN \
  --gitlabProjectId 12345 \
  --githubOwner username \
  --githubRepo project

3. 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)
![Stars](https://img.shields.io/github/stars/username/project)

Multiple projects: bulk migration

Script for migrating several projects at once:

#!/bin/bash

GITLAB_URL="https://gitlab.com"
GITHUB_URL="https://github.com"

# Your repositories
declare -a repos=(
  "project1"
  "project2"
  "project3"
)

for repo in "${repos[@]}"; do
  echo "Migrating $repo..."

  git clone --bare $GITLAB_URL/username/$repo.git
  cd $repo.git
  git push --mirror $GITHUB_URL/username/$repo.git
  cd ..
  rm -rf $repo.git

  echo "✅ $repo done!"
done

Team migration

Notify your team:

## 📣 We're moving to GitHub!

**Old (GitLab):**
https://gitlab.com/team/project

**New (GitHub):**
https://github.com/team/project

**Instructions for the team:**

### If you already have a local clone:

\`\`\`bash
cd project
git remote set-url origin https://github.com/team/project.git
git fetch
\`\`\`

### For new clones:

\`\`\`bash
git clone https://github.com/team/project.git
\`\`\`

**Deadline:** April 15, 2026
After that, the GitLab repo will be read-only.

Preserving GitLab history

If you want to keep Issues/MRs:

1. Export the GitLab project

  1. GitLab → Settings → General
  2. Advanced → Export project
  3. Download the archive (.tar.gz)

Keep it as a backup!

2. Make GitLab read-only

  1. Settings → General → Permissions
  2. Project visibility → Private
  3. ✅ Disable forking
  4. ✅ Disable merge requests
  5. Add a banner to the README:
## ⚠️ This project moved to GitHub

**New location:**
https://github.com/username/project

CI/CD comparison

Feature GitLab CI GitHub Actions
Config file .gitlab-ci.yml .github/workflows/*.yml
Runners Shared/Own GitHub hosted/Self-hosted
Free minutes 400/month 2,000/month
Artifacts 1 GB 500 MB
Docker support ✅ Excellent ✅ Excellent
Complexity Simpler Slightly more complex

Common issues

Protected branches

GitLab → Settings → Repository → Protected Branches

Recreate them in:

GitHub → Settings → Branches → Branch protection rules

LFS (Large File Storage)

If you use Git LFS:

# Clone with LFS
git lfs clone --bare https://gitlab.com/user/repo.git

# Push with LFS
cd repo.git
git lfs push --all https://github.com/user/repo.git

Different authentication

GitLab may use Deploy Keys; GitHub uses Deploy Keys or Personal Access Tokens.

Update them in:
- CI/CD secrets
- Deployment scripts
- Webhooks

Why GitHub?

For developers:

  • ✅ Greater portfolio visibility
  • ✅ More job opportunities
  • ✅ Easier for beginners
  • ✅ GitHub Copilot
  • ✅ Codespaces (cloud IDE)

For companies:

  • ✅ GitHub Advanced Security
  • ✅ Dependabot (automatic security updates)
  • ✅ GitHub Sponsors (open-source monetization)

Why GitLab is better:

  • ✅ More powerful CI/CD out of the box
  • ✅ More cost-effective for large teams
  • ✅ Self-hosted option
  • ✅ Built-in container registry

Rolling back the migration

Changed your mind? You can reverse it:

git clone --bare https://github.com/user/repo.git
cd repo.git
git push --mirror https://gitlab.com/user/repo.git

Migration checklist

  • [ ] Exported Issues/MRs (if needed)
  • [ ] Created repository on GitHub
  • [ ] Migrated 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
  • [ ] Updated documentation
  • [ ] Tested CI/CD pipelines
  • [ ] Made GitLab repo read-only

Happy migrating! Welcome to GitHub! 🎉

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

📝

Git Hosting Platforms: Full Comparison 🏆

GitHub, GitLab, Bitbucket — which one to choose? A complete comparison with up-to-date data.

📅 06.05.2026 👁️ 52
📝

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 👁️ 56
📝

Why Git won over every other version control syst…

Today Git is the de facto standard for version control in software development. But it...

📅 06.05.2026 👁️ 51

Did you like the article?

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