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.

FeatureGitHubForgejo
Pull requestsYesYes
CI/CDGitHub ActionsForgejo Actions (compatible syntax)
Package registryYesYes
Container registryYesYes
Code searchYesYes
WikiYesYes
Projects/boardsYesBasic
CopilotYesNo (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.

FeatureGitHubGitLab CE
CI/CDGitHub ActionsGitLab CI (superior pipeline syntax)
Container registryYesYes
Package registryYesYes (all major formats)
Security scanningDependabotSAST/DAST (limited in CE)
Auto DevOpsNoYes
Kubernetes integrationLimitedBuilt-in
Minimum RAMN/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:

  1. Go to New Migration in the web UI
  2. Select GitHub as the source
  3. Enter a GitHub personal access token (PAT) with repo scope
  4. 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:

  1. Go to New Project → Import project → GitHub
  2. Authenticate with a GitHub PAT
  3. 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 FreeGitHub TeamForgejoGitLab CE
Monthly cost (10 users)$0$40/month$0$0
Annual cost (10 users)$0$480/year~$36/year (VPS)~$72/year (VPS)
Private reposUnlimitedUnlimitedUnlimitedUnlimited
CI/CD minutes2,000/month3,000/monthUnlimitedUnlimited
Storage limit500 MB packages2 GB packagesYour diskYour disk
Container registry500 MB2 GBYour diskYour disk
Self-hostedNoNoYesYes
Data ownershipMicrosoftMicrosoftYouYou

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.

Comments