To self-host Git means running your own Git server so your source code lives on infrastructure you control rather than on GitHub or GitLab.com. For UK developers, teams and agencies, that translates into data ownership, UK data residency and freedom from per-seat SaaS fees. This guide compares Gitea vs Forgejo vs GitLab CE and shows you how to get a self-hosted Git server running on a UK VPS using Docker.
What Is a Self-Hosted Git Server?
A self-hosted Git server is a full Git remote you operate yourself, complete with a web interface, issue tracking, pull requests and access control. Instead of pushing commits to a third-party platform, your team pushes to a Git repository that lives on a server you own and administer. The Git protocol itself is unchanged, so day-to-day commands such as git clone, git push and git pull work exactly as they do with GitHub.
The difference is where the data lives and who holds the keys. A self-hosted Git platform gives you a genuine GitHub alternative with a familiar web UI, but every repository, issue and CI/CD pipeline sits on your own VPS. You decide the storage, the backup policy, the authentication rules and the geographic location of the data.
Why Self-Host Your Git Repositories
There are several practical reasons a team chooses to run its own Git server rather than paying for a hosted SaaS plan.
- Data ownership and privacy β your proprietary code never leaves infrastructure you control, which matters for client work under NDA and for regulated sectors.
- UK data residency β hosting on a UK VPS keeps source code and metadata inside the UK, simplifying data-protection commitments.
- Cost predictability β a single VPS replaces per-seat monthly fees, so adding developers does not increase your bill.
- Full control β you choose the versions, plugins, authentication and CI/CD runners, with no feature gating behind a paid tier.
The trade-off is that you become responsible for updates, security and backups. If you would rather someone else handled the operating system layer, it is worth reading our comparison of managed vs unmanaged VPS hosting before you commit.
What You Need to Self-Host Git
The requirements to self-host Git are modest for the lightweight options and heavier for a full DevOps platform. At a minimum you need a UK VPS running a modern Linux distribution, Docker installed, a domain or subdomain pointing at the server, and open ports for the web interface and Git over SSH. Gitea or Forgejo run happily on a small 1β2GB VPS, while GitLab CE realistically wants 4GB or more of RAM. A basic familiarity with Docker and the command line rounds out the list.
Gitea vs Forgejo vs GitLab CE
The three leading self-hosted Git platforms fall into two camps: lightweight code forges (Gitea and Forgejo) and a full DevOps suite (GitLab CE). Understanding the split is the key to choosing well.
Gitea is a fast, lightweight forge written in Go. It ships as a single binary or a tiny Docker image, offers a clean GitHub-like UI with issues and pull requests, and includes Gitea Actions β a GitHub-Actions-compatible CI/CD engine. It runs comfortably on roughly 1GB of RAM, making it an excellent default for small teams.
Forgejo is a community-driven hard fork of Gitea, maintained by the people behind Codeberg. It is nearly identical to use, with the same tiny footprint and its own Forgejo Actions, but it is governed as a fully independent, community-owned project. Choose it if you value that independence stance; migration between the two is straightforward.
GitLab CE (Community Edition) is a complete DevOps platform. Alongside Git hosting it bundles built-in CI/CD pipelines, a container registry, issue boards and a wiki in one application. That power comes at a cost: it is much heavier and realistically wants 4GB or more of RAM (8GB is comfortable) plus more CPU and disk.
| Feature | Gitea | Forgejo | GitLab CE |
|---|---|---|---|
| Footprint | Tiny (~1GB RAM) | Tiny (~1GB RAM) | Heavy (4β8GB RAM) |
| Language | Go | Go | Ruby/Go |
| Built-in CI/CD | Gitea Actions | Forgejo Actions | Full GitLab CI |
| Container registry | Basic | Basic | Yes |
| Governance | Company-backed | Community-owned | GitLab Inc. |
| Best for | Small teams | Independence-minded teams | All-in-one DevOps |
How to Install Gitea on UK VPS
Gitea is the quickest way to stand up a self-hosted Git server. The cleanest approach uses Docker Compose, which keeps the application, its data volume and its database tidy. If you are new to Compose, our Docker Compose on UK VPS guide covers the fundamentals.
Create a docker-compose.yml like the one below. It maps port 3000 for the web UI and an alternative SSH port of 2222 so it does not clash with your host’s own SSH daemon on port 22.
services:
gitea:
image: gitea/gitea:latest
container_name: gitea
restart: always
environment:
- USER_UID=1000
- USER_GID=1000
- GITEA__server__DOMAIN=git.example.co.uk
- GITEA__server__SSH_PORT=2222
volumes:
- ./gitea-data:/data
ports:
- "3000:3000"
- "2222:22"
Bring it up with a single command, then open the web installer on port 3000 to complete setup. Gitea uses a built-in SQLite database by default, which is fine for small teams; larger deployments can point it at PostgreSQL.
docker compose up -d
For anything beyond a quick test, front the service with a reverse proxy and a Let’s Encrypt certificate so the web UI runs over HTTPS. The official Gitea documentation covers reverse-proxy configuration, database tuning and the full range of environment variables in detail.
How to Install Forgejo and GitLab CE
Forgejo
Because Forgejo is a fork of Gitea, its Docker setup is almost identical β swap the image and you are done. Everything else, from the volume to the alternative SSH port, mirrors the Gitea example above.
services:
forgejo:
image: codeberg.org/forgejo/forgejo:latest
container_name: forgejo
restart: always
volumes:
- ./forgejo-data:/data
ports:
- "3000:3000"
- "2222:22"
GitLab CE
GitLab CE uses the official gitlab/gitlab-ce image. Set the external URL to your domain and mount three volumes for config, logs and data. Be patient: GitLab is a large application and can take several minutes to finish booting on first run.
docker run -d --name gitlab
--hostname git.example.co.uk
-p 443:443 -p 80:80 -p 2222:22
-v ./gitlab/config:/etc/gitlab
-v ./gitlab/logs:/var/log/gitlab
-v ./gitlab/data:/var/opt/gitlab
--restart always
gitlab/gitlab-ce:latest
Because GitLab bundles its own CI/CD runners, database and registry, make sure your VPS has the headroom described earlier. If your interest in GitLab is mainly its pipelines, it is worth understanding the wider container ecosystem β our look at Kubernetes vs Docker Swarm puts self-hosted orchestration in context.
Configure SSH and HTTPS Remotes
Once your server is running, you connect to your Git repository over either SSH or HTTPS. For SSH, add your public key in the web UI under your account’s SSH settings, then add the remote. Note the custom port if you mapped Git SSH to 2222.
# SSH remote (custom port 2222)
git remote add origin ssh://[email protected]:2222/user/repo.git
# HTTPS remote (authenticate with a personal access token)
git remote add origin https://git.example.co.uk/user/repo.git
For HTTPS, generate a personal access token in the web UI and use it in place of a password when Git prompts you. HTTPS works well behind a reverse proxy with a Let’s Encrypt certificate. Because your Git server is now exposed to the internet, tightening the host’s SSH configuration is essential β follow our SSH hardening guide to lock the box down properly.
Back Up and Restore Your Git Server
A self-hosted Git server is only as safe as its backups. There are three things to protect: the repository data, the database, and the configuration. Both Gitea and GitLab provide dedicated backup tools that bundle these together.
# Gitea / Forgejo: create a full dump
docker exec -u git gitea gitea dump -c /data/gitea/conf/app.ini
# GitLab CE: create a backup
docker exec gitlab gitlab-backup create
Schedule these dumps with cron and copy the archives off-site β to object storage or a second server β so a single VPS failure never loses your history. Test a restore occasionally so you know the process works before you need it. Automating this chain is a natural fit for a workflow tool such as self-hosted n8n automation.
Choose the Right Git Platform
The right choice comes down to resources and ambition. For most small teams, agencies and solo developers, Gitea or Forgejo is the sensible default: they are light, fast and cheap to run, giving you a complete GitHub alternative on a modest UK VPS. Pick Forgejo over Gitea if community-owned governance matters to you, or Gitea if you prefer its slightly larger ecosystem.
Choose GitLab CE when you genuinely need an all-in-one DevOps platform β integrated CI/CD, a container registry and enterprise-style features on one system β and you can spare the 4GB or more of RAM it demands. On a suitably sized UK VPS from UK Speed, any of the three will give you a fast, private and fully owned Git repository host.
Conclusion
Deciding to self-host Git buys you data ownership, UK residency and predictable costs in exchange for taking on updates and backups. For most people the lightweight route wins: run Gitea or Forgejo on a small VPS and you have a private, capable Git server in minutes. Reserve GitLab CE for when you truly need its full DevOps toolkit.
- Pick a UK VPS sized to your platform β 1β2GB for Gitea/Forgejo, 4GB+ for GitLab CE.
- Deploy with Docker, then front the web UI with HTTPS via a reverse proxy.
- Add your SSH key and configure your first remote.
- Schedule off-site backups and harden SSH before going live.
