Your own Git: Forgejo or Gitea
How to set up a personal repository server with a web interface, SSH access, and build runs — and what to copy so you don't lose your code.
Updated August 23, 2026
You need your own Git when code must not leave for someone else's platform, or when you want no limits on private repositories and build minutes. Forgejo and Gitea are two closely related projects (Forgejo grew out of Gitea); both install in a single container and run on a modest machine.
What to choose and how many resources
There's almost no difference in day-to-day work: the interface, issues, pull requests, mirrors, Actions for builds. Forgejo is developed by a community, Gitea by a company. Choose Forgejo if project independence matters to you.
For two or three people, VDS-1 is enough. As soon as you add a runner for builds, take VDS-3 or higher: builds eat up CPU and disk, and disk speed is limited by tier.
Installing via Compose
services:
forgejo:
image: codeberg.org/forgejo/forgejo:11
container_name: forgejo
restart: unless-stopped
environment:
- USER_UID=1000
- USER_GID=1000
volumes:
- ./data:/data
- /etc/timezone:/etc/timezone:ro
ports:
- "3000:3000"
- "2222:22"
docker compose up -d
docker compose logs -f forgejo
Open http://<machine-address>:3000 and go through the initial setup. The first user created becomes the administrator.
You don't need to leave port 3000 open to the outside. Close it and put a web server with a certificate in front of the service — that way you get HTTPS and don't show the setup panel to outsiders. Until setup is complete, anyone who opens the address can create the administrator first.
SSH access
Port 22 inside the container is forwarded to 2222, because 22 is taken by the system SSH. In the repository settings, the address will look like this:
git clone ssh://git@example.com:2222/user/repo.git
If you want the usual git@example.com:user/repo.git without a port, leave 2222 for the container and set up forwarding on the host via the system SSH, or move the administrative SSH to another port (see access protection).
Builds
Actions are run by a separate runner — the forgejo-runner container, which registers with a token from the administrator settings. Give it access to the Docker socket only deliberately: it's equivalent to root on the machine. For builds, it's better to limit the runner by memory and CPU — see resource limits.
What to back up
All state is stored in the ./data volume: repositories, database, attachments, configuration. A backup is made like this:
docker compose stop forgejo
restic -r <repository> backup ./data
docker compose start forgejo
You need to stop the service if it uses SQLite — otherwise the database snapshot may be inconsistent. With PostgreSQL, pg_dump is enough without stopping. For more details, see what exactly to back up and Restic.
Common mistakes
- Forgetting about repository size. Game server builds and media quickly eat up disk space: 40 GB of the entry tier runs out unnoticed.
- Email not set up. Without it, invitations and password resets don't work. It's easier to connect an external SMTP than to set up your own mail server.
- Updating without a backup. Changing the major version changes the database schema. First a backup, then
docker compose pull— see updating containers.