Self-Hosted Alternatives to GitHub
Why Replace GitHub?
GitHub is where most open-source projects live, and for public repositories it works well. But there are real reasons to move your private code off GitHub:
- Microsoft owns your workflow. GitHub Actions, Copilot, Codespaces — increasing lock-in. Microsoft’s 2018 acquisition has steadily shifted GitHub from neutral platform to Microsoft product integration layer.
- Privacy. Your private repositories live on Microsoft’s servers. GitHub scans code for Copilot training, and while they claim enterprise repos are excluded, the terms have shifted before.
- Pricing. GitHub Teams costs $4/user/month. At 20 developers, that’s $960/year for features that self-hosted alternatives include free.
- Copilot concerns. GitHub Copilot was trained on public repositories, including copyleft-licensed code. If you’re building proprietary software, hosting on the same platform raises questions about code exposure.
- Outages affect everyone. GitHub has had multiple significant outages in recent years. Self-hosting means your CI/CD doesn’t stop when GitHub does.
Best Alternatives
Forgejo — Best Overall Replacement
Forgejo is a community-governed fork of Gitea, backed by Codeberg. It matches most GitHub features — pull requests, issues, CI/CD (Forgejo Actions, compatible with GitHub Actions workflows), package registries, and container registries — while running on ~100 MB of RAM.
Forgejo is the recommended default for new deployments. The community governance model means no single company can change the licensing or direction.
| Feature | GitHub | Forgejo |
|---|---|---|
| Pull requests | Yes | Yes |
| CI/CD | GitHub Actions | Forgejo Actions (compatible syntax) |
| Package registry | Yes | Yes |
| Container registry | Yes | Yes |
| Code search | Yes | Yes |
| Wiki | Yes | Yes |
| Projects/boards | Yes | Basic |
| Copilot | Yes | No (use local LLMs) |
Read our full guide: How to Self-Host Forgejo
Gitea — Best for Existing Users
Gitea is the project Forgejo forked from. Functionally nearly identical, but now backed by a for-profit company (Gitea Ltd). If you’re already running Gitea, there’s no urgent reason to switch — but new deployments should prefer Forgejo for its community governance.
Gitea Actions provides GitHub Actions compatibility. Gitea packages and container registries work the same as Forgejo’s. The admin interface and API are mature.
Read our full guide: How to Self-Host Gitea
GitLab CE — Best for Enterprise and Full DevOps
GitLab Community Edition is the closest 1:1 replacement for GitHub at scale. Built-in CI/CD (GitLab CI), container registry, package registry, issue tracking, wiki, and project management. GitLab CE is what you deploy when your team needs everything GitHub offers and more.
The tradeoff: GitLab CE requires 4+ GB of RAM minimum and is significantly more complex to operate than Gitea or Forgejo.
| Feature | GitHub | GitLab CE |
|---|---|---|
| CI/CD | GitHub Actions | GitLab CI (superior pipeline syntax) |
| Container registry | Yes | Yes |
| Package registry | Yes | Yes (all major formats) |
| Security scanning | Dependabot | SAST/DAST (limited in CE) |
| Auto DevOps | No | Yes |
| Kubernetes integration | Limited | Built-in |
| Minimum RAM | N/A (cloud) | 4 GB |
Read our full guide: How to Self-Host GitLab CE
OneDev — Best All-in-One Alternative
OneDev combines Git hosting, CI/CD, issue tracking, and project management in a single Java application. Its CI/CD engine uses a visual pipeline editor and supports Docker-based builds without external runners. OneDev also includes built-in code search, SLOC statistics, and a symbol navigator — features that require third-party tools on GitHub.
OneDev is less well-known than Gitea or GitLab but competitive on features for small to mid-size teams.
Read our full guide: How to Self-Host OneDev
Gogs — Best Lightweight Option
Gogs is the lightest self-hosted Git server at ~50 MB of RAM. It covers the basics — repositories, issues, pull requests, webhooks — but lacks CI/CD, package registries, and the larger community of its fork Gitea. Choose Gogs only if you run on extremely constrained hardware and don’t need automation features.
Read our full guide: How to Self-Host Gogs
Migration Guide
From GitHub to Forgejo/Gitea
Both Forgejo and Gitea include a built-in migration tool:
- Go to New Migration in the web UI
- Select GitHub as the source
- Enter a GitHub personal access token (PAT) with
reposcope - Choose repositories to migrate
The migration tool imports:
- Repository content (all branches and tags)
- Issues and comments
- Pull requests
- Labels and milestones
- Releases
What doesn’t migrate:
- GitHub Actions workflows (need adaptation for Forgejo/Gitea Actions)
- GitHub Projects boards
- GitHub Packages
- Discussions
From GitHub to GitLab CE
GitLab CE also has built-in GitHub import:
- Go to New Project → Import project → GitHub
- Authenticate with a GitHub PAT
- Select repositories
GitLab imports repositories, issues, pull requests (as merge requests), labels, milestones, and releases. CI/CD workflows need rewriting from GitHub Actions to GitLab CI syntax — they’re not compatible.
Git Remotes (Any Platform)
For a simple repository-level migration without issues or metadata:
# Clone from GitHub with all branches
git clone --mirror https://github.com/user/repo.git
# Push to your self-hosted instance
cd repo.git
git remote set-url origin https://git.yourdomain.com/user/repo.git
git push --mirror
Cost Comparison
| GitHub Free | GitHub Team | Forgejo | GitLab CE | |
|---|---|---|---|---|
| Monthly cost (10 users) | $0 | $40/month | $0 | $0 |
| Annual cost (10 users) | $0 | $480/year | ~$36/year (VPS) | ~$72/year (VPS) |
| Private repos | Unlimited | Unlimited | Unlimited | Unlimited |
| CI/CD minutes | 2,000/month | 3,000/month | Unlimited | Unlimited |
| Storage limit | 500 MB packages | 2 GB packages | Your disk | Your disk |
| Container registry | 500 MB | 2 GB | Your disk | Your disk |
| Self-hosted | No | No | Yes | Yes |
| Data ownership | Microsoft | Microsoft | You | You |
What You Give Up
Be honest about the tradeoffs:
- Network effects. GitHub is where developers discover projects. If you need public visibility, maintain a GitHub mirror alongside your self-hosted primary.
- GitHub Actions ecosystem. Thousands of pre-built actions. Forgejo Actions is compatible with most, but some vendor-specific actions won’t work.
- GitHub Copilot. No direct equivalent on self-hosted Git. Use local LLM alternatives (Continue, Tabby, or local Copilot alternatives).
- Dependabot. Automated dependency updates. Renovate Bot is a self-hosted alternative that works with Gitea, Forgejo, and GitLab.
- GitHub Pages. Free static hosting. Replace with Cloudflare Pages, Netlify, or a self-hosted option.
- Uptime guarantees. GitHub has a large SRE team. Your self-hosted instance is your responsibility. Run backups.
Related
Get self-hosting tips in your inbox
Get the Docker Compose configs, hardware picks, and setup shortcuts we don't put in articles. Weekly. No spam.
Comments