Blog / Tutorials

Self-Host Gitea on a VPS: Your Own Lightweight Git Server

By the NoctHost TeamAugust 3, 2026Updated October 24, 20263 min read

GitHub is convenient, but not every repository needs to live on someone else's servers, private client work, personal projects, or anything you would rather not hand to a platform that trains models on public code. Gitea is a lightweight, self-hosted Git service: pull requests, issues, CI hooks and a clean web UI, running on a server you own.

It is famously light. The whole thing fits comfortably on the smallest VPS. Here is the full setup with HTTPS and SSH cloning.

What You Need

  • A VPS with 1 GB RAM (Gitea sips resources)
  • Ubuntu 22.04 or 24.04 with SSH
  • A domain or subdomain pointed at the server

Step 1: Install Docker

curl -fsSL https://get.docker.com | sh

Step 2: Compose with Caddy HTTPS

Save as docker-compose.yml. This runs Gitea with SQLite (fine for a personal or small-team instance) and Caddy for automatic certificates:

services:
  gitea:
    image: gitea/gitea:latest
    restart: always
    environment:
      - GITEA__server__DOMAIN=git.example.com
      - GITEA__server__ROOT_URL=https://git.example.com/
      - GITEA__server__SSH_DOMAIN=git.example.com
    volumes:
      - gitea:/data
    ports:
      - "2222:22"

  caddy:
    image: caddy:2-alpine
    restart: always
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile
      - caddy_data:/data
    depends_on:
      - gitea

volumes:
  gitea:
  caddy_data:

Note Gitea's SSH is mapped to host port 2222 so it does not collide with your own SSH on port 22.

Step 3: The Caddyfile

git.example.com {
  reverse_proxy gitea:3000
}

Bring it up:

docker compose up -d

Step 4: First-Run Setup

Open https://git.example.com and complete the install screen. The database is SQLite (already configured), so just set your admin account. Then, and this matters, go to Site Administration and disable open registration unless you want the public signing up:

Set "Disable Self-Registration" and require admin approval for new users.

Step 5: Clone Over SSH

Add your public key in Gitea under Settings → SSH Keys, then clone using the mapped port:

git clone ssh://git@git.example.com:2222/youruser/yourrepo.git
Tip: Add a nightly backup of the gitea volume. A tar of /data plus your SQLite file is your whole server, off-site copy it with rclone and you can rebuild anywhere in minutes.

What It Costs

Gitea is one of the lightest useful things you can self-host, so the Micro plan (1 vCPU, 1 GB) runs a personal or small-team instance comfortably. On NoctHost that is about $10 a month, billed hourly from a prepaid balance you top up with crypto (no KYC) or a card, which suits keeping private repositories genuinely private.

Spin one up in about a minute

Email signup, pay with crypto or card, hourly billing. Trying a box costs cents: destroy it when you are done.

Deploy a server

Frequently asked

Gitea vs GitLab, which should I self-host?
Gitea is far lighter and runs on a 1 GB VPS; GitLab is more powerful but wants several GB of RAM and more upkeep. For personal repos and small teams, Gitea is the pragmatic choice.
Can I use it with my existing Git tooling?
Yes. Gitea speaks standard Git over HTTPS and SSH, so your existing clients, IDE integrations and CI runners work unchanged, just point them at your domain.
Is SQLite good enough?
For a personal or small-team instance, yes. Switch to Postgres only if you grow to many active users; for most self-hosters SQLite is simpler and plenty fast.
How do I keep it updated?
Run docker compose pull && docker compose up -d. Gitea handles its own migrations on start, and your data lives in the volume, not the image.

Keep reading