Want a private GitHub that you fully control? Gitea is a lightweight Git server that runs great in a single Docker container.

Why self-host

  • You own your repositories and your data.
  • No user or repo limits.
  • Runs on a $5 VPS or an old PC.

The setup

Create a docker-compose.yml:

version: "3"

services:
  gitea:
    image: gitea/gitea:latest
    container_name: gitea
    environment:
      - USER_UID=1000
      - USER_GID=1000
    restart: always
    volumes:
      - ./gitea:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "3000:3000"
      - "222:22"

Then start it:

docker compose up -d

Visit http://your-server:3000 and complete the web installer. That’s it — you have a working Git server.

Next steps

  • Put it behind a reverse proxy (Caddy or Nginx) with HTTPS.
  • Enable backups of the ./gitea volume.
  • Create an organization for your projects.

Self-hosting Git is one of the highest-leverage homelab projects you can do.