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.

FAQ

Can I mirror repositories between GitHub and a self-hosted instance?

Yes. Forgejo and Gitea support repository mirroring — set up a mirror that automatically syncs from GitHub to your self-hosted instance (or vice versa). This lets you maintain public visibility on GitHub while using your self-hosted platform as the primary. GitLab CE has built-in project mirroring with push and pull modes. Run both in parallel during migration to avoid disruption.

Do GitHub Actions workflows work on Forgejo or Gitea?

Forgejo Actions and Gitea Actions are compatible with most GitHub Actions workflows. They use the same YAML syntax and support many GitHub Actions from the marketplace. Some vendor-specific actions (AWS, Azure, Vercel) may need adaptation, and self-hosted runners replace GitHub’s cloud runners. For most CI/CD workflows (build, test, deploy), your existing .github/workflows/ files work with minimal changes.

How much server resources does a self-hosted Git platform need?

Forgejo and Gitea are lightweight: 512 MB RAM and 1 CPU core handles dozens of users and hundreds of repositories comfortably. GitLab CE is heavier — minimum 4 GB RAM, recommended 8 GB for a team of 10-20. Gogs is the lightest at under 256 MB RAM. Storage depends on repository sizes — a typical small team with 50 repositories needs 5-10 GB. Choose Forgejo/Gitea for resource efficiency, GitLab CE for feature parity.

Will I lose access to open-source contributions if I leave GitHub?

You won’t lose access to your existing contributions — your GitHub profile and contributions history remain. For ongoing open-source work, keep a GitHub account for contributing to projects hosted there. Use your self-hosted instance for private repositories and internal projects. Many developers run both: GitHub for open-source participation, self-hosted for everything else.

How do I handle dependency updates without Dependabot?

Install Renovate Bot — it’s open-source and works with Forgejo, Gitea, GitLab CE, and Bitbucket. Renovate creates merge/pull requests for dependency updates with changelogs and compatibility scores. It’s more configurable than Dependabot and supports more package managers. Run it as a cron job or Docker container on your server.

Can I replace GitHub Pages with self-hosted static site hosting?

Yes. Push your static site to your self-hosted Git platform and deploy via CI/CD to Cloudflare Pages (free), Netlify (free tier), or your own web server. Forgejo and Gitea Actions can trigger deployments on push. GitLab CE has built-in Pages support. You can also use Caddy or Nginx to serve static sites directly from your server.

Is Forgejo or Gitea better for replacing GitHub?

Forgejo is the recommended choice for new deployments. It’s a community-governed fork of Gitea (created after Gitea’s governance became corporate-controlled). Forgejo and Gitea are feature-equivalent, but Forgejo prioritizes community governance and user freedom. Both support Actions CI/CD, container registries, and GitHub-compatible APIs. Forgejo is the safer long-term bet for self-hosters who value project independence.

Comments