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:
- Go to github.com/new/import
- Paste the GitLab URL:
https://gitlab.com/username/project - If the repo is private → enter your GitLab Personal Access Token:
- GitLab → Settings → Access Tokens
- Create a token with theread_repositoryscope - Choose a repository name on GitHub
- Select Public/Private
- 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
- Clone the GitLab repository:
- File → Clone Repository → URL
- Paste the GitLab HTTPS URL - After cloning: click Publish repository
- 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):
[]
After (GitHub):


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
- GitLab → Settings → General
- Advanced → Export project
- Download the archive (.tar.gz)
Keep it as a backup!
2. Make GitLab read-only
- Settings → General → Permissions
- Project visibility → Private
- ✅ Disable forking
- ✅ Disable merge requests
- 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! 🎉
💬 Comments (0)
No comments yet
Be the first to share your opinion about this article!