Gitea on a VPS: your own Git server with Docker Compose

The short answer: Gitea is a light, free Git server, with a web page like the well-known services’: repositories, pull requests and users, on your VPS. It suits small teams that want the code in a place of their own. It runs in Docker, uses little memory and needs few updates.

What the site needs

What What to do
What it gives Private and public repositories, branches, pull requests, issues, and access over HTTPS and SSH.
What it needs A VPS with Docker, a domain with HTTPS and, for SSH access, a port (the server’s own SSH already uses 22).
Database For a small team, the built-in SQLite is enough. For more people, a separate database.
Who can register Switch off open registration after creating the accounts.
To publish the site The repository can be tied to the hosting: Deploying from Git.

Getting started

1 Install Docker: Installing Docker.
2 Create a folder and the compose.yaml file: services:
  gitea:
    image: gitea/gitea:1
    restart: unless-stopped
    environment:
      - USER_UID=1000
      - USER_GID=1000
    ports:
      - "127.0.0.1:3000:3000"
      - "2222:22"
    volumes:
      - ./data:/data
3 Start it (docker compose up -d) and make the domain’s proxy and HTTPS point to port 3000: Nginx in front of a container.
4 Open the address and fill in the install page: choose SQLite, put the site’s public address and create the administrator account. Switch off new-user registration.
5 Add your SSH key to the account and use the repository address with port 2222: Creating an SSH key.
Port 2222 is open to the world. As with the rest of the server, keep it up to date, with the right firewall and fail2ban: Keeping your VPS secure. And back up the data folder, which holds all the repositories: Data folders.
To only publish a site from a repository on another service, see Git in cPanel. To update Gitea without losing data: Updating a Docker application.

Want help setting up a Git server? Open a ticket with the VPS plan.

Open a support ticket

SEE ALSO

Installing Docker and Docker Compose on a VPS

Nginx as a reverse proxy in front of a container

How to create an SSH key and log in to your VPS without a password

Git in cPanel: publishing your site from a repository

Updating a Docker application without losing data

RECOMMENDED PRODUCT

VPS server with root access

Resources of your own, the OS you choose, reinstall whenever you like. from $8.40/mo (3-year plan, with coupon)

See plans
  • 0 Users Found This Useful
Was this answer helpful?