Planning to migrate from GitHub to a self-hosted alternative? You’re not alone! Many dev teams are making this switch to gain more control, privacy, and freedom. But the move isn’t always painless — especially if you care about keeping your issues, pull requests, and history nice and tidy.
TLDR: If you’re moving off GitHub, you’ll want to avoid data loss and broken workflows. Six tools can help you migrate with everything intact — from code history to issues and PRs. Some automate almost everything; others give you precise control. Stick around to find out which one can power your next migration!
The Why Behind GitHub Migration
Maybe your team wants to avoid vendor lock-in. Maybe privacy is the biggest priority. Or maybe it’s all about cost and customizability. Whatever the reason, self-hosted Git platforms like Gitea, GitLab CE, and Forgejo are gaining popularity.
But moving is tricky. GitHub holds not just your code but also:
- Commit history
- Pull requests (PRs)
- Issues and comments
- Labels and milestones
- Wiki and discussions
You probably don’t want to lose any of that. Luckily, some smart tools can help!
Here are the 6 best tools for seamless GitHub migration:
1. git clone & push — DIY for the Hardcore
This one’s for the purists. If you’re just migrating repo files and commit history, you can simply use the built-in git clone and git push commands. That’s it!
git clone --mirror https://github.com/your-org/your-repo.git
cd your-repo.git
git push --mirror ssh://git@example.com/your-new-repo.git
Pros:
- Simple and fast for code & commit history
- No dependencies
Cons:
- Doesn’t migrate issues, PRs, or metadata
- You’ll need more tools for a complete move
Verdict? Great for small, simple projects or as a first step in larger migrations.
2. GitHub API + Scripts — Build Your Own Tool
If you’re a fan of scripting, you can use GitHub’s REST or GraphQL API to fetch issues, labels, milestones, and even PRs — then recreate them on your destination platform using its API.
Use if: You’re good with Python, Bash, or Node, and want full control.
Pros:
- Perfect for customized migrations
- Script once, use forever
Cons:
- Time-consuming
- Requires API knowledge and maintenance
This approach works nicely if your target is GitLab, Gitea, or Forgejo since most of them have compatible APIs.
3. gitlab-mirror — Best for Moving to GitLab
If your new home is GitLab (especially self-hosted GitLab CE), this tool is awesome. It handles repo mirroring and can replicate issues, merge requests, and labels via import APIs.
Bonus: GitLab even offers a GitHub import feature built into its UI.
Pros:
- Automated and well-documented
- Built-in to GitLab in many cases
Cons:
- Only works if GitLab is the destination
- Customization is somewhat limited
It’s an excellent set-it-and-go method for teams shifting entire projects, especially if you’re replicating an entire org.
4. Gitea/Gogs Migrate Feature — Easy One-Click Imports
If you’re moving to Gitea or Gogs, good news — they come with a built-in migration feature. Just throw in your GitHub token and the repo URL, and you’re halfway there.
This migration grabs:
- Repositories & commit history
- Issues and pull requests
- Labels and milestones
Pros:
- Super easy
- No scripting required
Cons:
- Limited to what Gitea supports
- May skip some metadata (like reactions or assignees)
Perfect for small teams or side projects with lots of history to keep.
5. ghorg — Fast Mass Cloner for Git Repos
Want to grab a bunch of GitHub repos all at once? ghorg is here to help. It’s a Go-based tool that can clone every repo under your organization (or user) into your local disk.
You can then push them to your self-hosted system of choice — Gitea, GitLab, etc.
Pros:
- Batch migrates dozens of repos quickly
- Supports GitHub, GitLab, Gitea, and more
Cons:
- Only handles repositories, not issues or PRs
- Needs a follow-up tool for full migration
This tool is lightning-fast and script-ready. Pair it with another tool like GitHub Issue Importer to complete the picture.
6. ghe-migrator — For Enterprise Migrations
If you have GitHub Enterprise and want to move off of it completely, ghe-migrator (provided by GitHub) lets you export full repositories, issues, attachments, wikis, and more.
It packages everything into a bundle that can later be imported into another system — given you find one that supports it, or can parse it.
Great for:
- Enterprise migration planning
- Backup and audit scenarios
Pros:
- Captures everything, including private artifacts
- Secure and complete
Cons:
- Enterprise-only tool
- Requires manual steps to import into other platforms
If you’re planning a mass move off GitHub Enterprise onto a private GitLab or Gitea instance, this may be your best first step.
Bonus Tip: Don’t Forget Webhooks and CI/CD!
Most migrations forget one crucial thing: your automation!
So after migrating the code and issues, double-check your:
- Webhooks and integrations (Slack bots, Jenkins, etc.)
- Deployment keys and secrets
- CI/CD pipelines
Many of your workflows are worth rethinking — or at least replicating — in the new platform. Most tools like GitLab and Gitea make this easy.
Final Thoughts
Migrating away from GitHub is a big move, but it doesn’t have to be painful. Between easy scripts and power tools, you can bring everything — from commits to issues and pull requests — right along with you.
Here’s a quick comparison table to help pick the right tool:
| Tool | Code | Issues/PRs | Best For |
|---|---|---|---|
| git clone & push | ✓ | ✗ | Simple code migration |
| GitHub API + Scripts | ✓ | ✓ | Custom workflows |