How to Switch from GitHub to Self-Hosted Git: A Complete Guide

GitHub — owned by Microsoft — is the world's largest code hosting platform, but it routes all your source code through US infrastructure subject to the CLOUD Act. For Canadian government contractors, defence suppliers, healthcare software companies, and any organization where source code is a strategic asset, hosting your own Git repositories on Canadian servers is increasingly a security requirement. Tools like Gitea, Forgejo (the community fork), and GitLab Community Edition make self-hosting simple and free.

What You'll Gain

  • Complete code sovereignty: Your source code, commit history, and issues live entirely on Canadian infrastructure. No US government agency can compel Microsoft to produce your code.
  • Zero per-seat cost: Gitea, Forgejo, and GitLab CE are free open-source software. Your cost is server infrastructure only — typically $20–50/month on a Canadian VPS for small teams.
  • Full control: Configure retention policies, access controls, mirroring, and backups exactly to your requirements. No GitHub terms-of-service surprises.
  • Air-gapped option: For maximum security, self-hosted Git can run on an air-gapped internal network — impossible with GitHub or any hosted service.
  • No vendor lock-in: Standard Git protocols mean your repositories can be moved or mirrored at any time. You're not dependent on GitHub's availability or pricing decisions.

What You Might Miss

  • No GitHub Actions ecosystem: GitHub Actions has thousands of community actions. Self-hosted Gitea/GitLab CI requires more setup for equivalent pipelines.
  • Smaller community discovery: GitHub is where open-source developers hang out. For public-facing open source projects, GitHub's social network and discoverability are unmatched.
  • IT maintenance: You're responsible for server uptime, updates, backups, and security patching of your Git server.
  • External contributor friction: Contributors expect GitHub. External PRs require accounts on your self-hosted instance, which adds friction for open-source projects.

What You'll Need

  • Admin access to your current GitHub account for data export
  • Self-Hosted Git account (trial available)
  • 2–4 hours for initial setup and configuration
  • A test group of 5–10 users for the pilot phase
  • A communication plan for your team about the transition

Step-by-Step Migration

  1. Choose your platform: Gitea/Forgejo (lightweight, easy setup) or GitLab CE (full DevOps platform). Gitea is faster to set up; GitLab CE offers more features including built-in CI/CD.
  2. Provision Canadian infrastructure: Set up a VPS on a Canadian cloud provider: AWS Canada (ca-central-1), OVHcloud Beauharnois QC, Hetzner (if Canadian data required), or your own server. Minimum 2 vCPU, 4GB RAM for Gitea; 4 vCPU, 8GB RAM for GitLab CE.
  3. Install and configure: Install Gitea or GitLab CE. Configure SSL (Let's Encrypt works well), SMTP for notifications, and OAuth/LDAP if you want SSO integration.
  4. Mirror repositories from GitHub: Use Gitea's built-in repository mirroring to pull all repos from GitHub. This maintains sync while you transition, allowing you to move at your own pace.
  5. Migrate issues and PRs: Use github-to-gitea migration tools or GitHub's export API to migrate issues and pull request history. Note: open PRs need to be recreated.
  6. Update CI/CD pipelines: Recreate GitHub Actions workflows as Gitea Actions (compatible syntax) or Gitlab CI pipelines. Test all build and deployment pipelines.
  7. Update webhooks and integrations: Update Slack/Teams notifications, Jira/Linear integrations, and deployment webhooks to point at your self-hosted instance.
  8. Redirect and archive GitHub: Add a notice to GitHub repos pointing to your new self-hosted location. Archive or delete GitHub repos once your team is fully migrated.

Tips for the Transition

  • Gitea's Docker image makes installation a one-command operation — ideal for teams without dedicated sysadmin resources.
  • Set up automated daily backups of your Gitea/GitLab database and repository storage from day one.
  • Forgejo (the community fork of Gitea) has an active development community and is a good choice for long-term sustainability.
  • Consider GitHub as a public mirror for any open-source components while keeping your private repos on self-hosted infrastructure.

The Canadian Angle

For Canadian government contractors under Protected B data requirements, or organizations under ITAR/export control, self-hosting code on Canadian servers is often the only compliant option. Canadian cloud providers like OVHcloud's Beauharnois, Quebec data centre and AWS ca-central-1 are commonly used for this purpose.

Timeline

Gitea can be deployed in a day. Full migration of a 50-person engineering team's GitHub repositories, CI/CD pipelines, and integrations typically takes 2–4 weeks.

Browse more Canadian software alternatives on EhList.ca →