Skip to content
In-house anti-DDoS, included on VPS, game servers and web hosting · hosted in France · cancel anytime See our plans
CloudFive
Log in

01

Gitea, Forgejo: a Git forge of your own

A Git forge adds everything needed to work together around your repositories: code browsing, issues, pull requests with review, wiki, organizations and teams, per-repository permissions, webhooks and continuous integration. Gitea and Forgejo do all this with a single program and stay lightweight, which suits personal use or a small team on a VPS.

  • Gitea: the original project, run by a company since 2022.
  • Forgejo: born in late 2022 from part of the Gitea community, which wanted a project run in the public interest. It sits under the umbrella of Codeberg e.V., a non-profit association, and has been an independent fork since early 2024: the two codebases are gradually drifting apart.

For a new installation, day-to-day use is very similar and the method is identical. Choose from the start: Forgejo only takes over an existing Gitea installation if it is at version 1.22 or earlier. This guide uses Forgejo as the example and points out the differences for Gitea.

If you mainly want to deploy your applications on every git push, Coolify can connect to a Gitea or Forgejo repository through a webhook.

02

Install with Docker Compose

You need a recent Linux VPS (Debian 12, Ubuntu 22.04 or 24.04), the settings from securing a Linux VPS and Docker with its Compose plugin: follow installing Docker on a VPS. Create the service folder. The documentation asks for the data folder to be owned by the UID and GID set in the file (1000 here):

sudo mkdir -p /opt/forgejo/forgejo
sudo chown -R 1000:1000 /opt/forgejo/forgejo
cd /opt/forgejo
sudo nano docker-compose.yml

Paste this file, based on the example in the official Forgejo documentation:

networks:
  forgejo:
    external: false

services:
  server:
    image: codeberg.org/forgejo/forgejo:17
    container_name: forgejo
    environment:
      - USER_UID=1000
      - USER_GID=1000
    restart: always
    networks:
      - forgejo
    volumes:
      - ./forgejo:/data
      - /etc/localtime:/etc/localtime:ro
    ports:
      - '127.0.0.1:3000:3000'
      - '222:22'
  • The image: 17 is the major version given by the documentation at the time of writing. This tag follows the minor releases of 17; use the number shown at the top of the Docker page of the Forgejo documentation. For Gitea, the image is docker.gitea.com/gitea, with latest or a specific version number.
  • Port 3000: the web interface, published here on 127.0.0.1 only: it will go through an HTTPS reverse proxy. Docker writes its own filtering rules ahead of UFW's: a port published without this address would be open to the whole Internet.
  • Port 222: the container's SSH server, for git clone and git push. Port 22 stays with the VPS's own SSH.
  • The database: with no setting, it is SQLite, a simple file in ./forgejo. It is enough for personal use or a small team. For PostgreSQL, add a db service and the variables FORGEJO__database__DB_TYPE=postgres, FORGEJO__database__HOST=db:5432, FORGEJO__database__NAME, FORGEJO__database__USER and FORGEJO__database__PASSWD, following the full example in the documentation. With Gitea, these variables start with GITEA__.
sudo docker compose up -d
sudo docker compose logs -f
03

The setup wizard

Open an SSH tunnel from your computer, then go to http://localhost:3000:

ssh -L 3000:127.0.0.1:3000 utilisateur@IP_DU_VPS

The first visit shows the setup wizard. Set it up right away for the final address:

  • Database: SQLite3 with the suggested path, or PostgreSQL with the host db:5432 and the credentials from the Compose file.
  • Server domain: your name, for example git.example.com.
  • SSH server port: 222. It is the port shown in clone addresses, so it must match the published port.
  • Base URL: https://git.example.com/, the public HTTPS address.
  • Registration: in the optional settings, disable self-registration if the forge is private. Otherwise anyone will be able to create an account.
  • Administrator account: create it in the wizard, with a long password. If you skip this step, the first registered account becomes administrator: register straight away.

The settings are then saved in the app.ini file, in the data folder. They can also be set through environment variables of the form FORGEJO__section__KEY (or GITEA__section__KEY), for example FORGEJO__service__DISABLE_REGISTRATION=true.

04

Git over SSH, HTTPS and reverse proxy

HTTPS. Put the forge behind Nginx Proxy Manager: add its proxy network to the networks list of the server service, then declare it at the top of the file:

networks:
  forgejo:
    external: false
  proxy:
    external: true

Restart with sudo docker compose up -d, then create a proxy host for git.example.com pointing to the host forgejo (the container name), port 3000, with a Let's Encrypt certificate and Force SSL. If large HTTPS pushes fail, raise the maximum request size accepted by the proxy.

Git over SSH. Each user adds their public key in their settings, under SSH keys. Cloning then works on port 222:

git clone ssh://git@git.example.com:222/utilisateur/projet.git

To stop typing the port, add this to ~/.ssh/config on your computer:

Host git.example.com
  Port 222
  User git

Since port 222 is published by Docker, it is open on the Internet even if UFW does not allow it. It only accepts keys registered in the forge. For a strictly private forge, publish it on a VPN address and go through WireGuard.

05

Actions, backups and updates

Actions. Gitea Actions and Forgejo Actions run continuous integration workflows written in the repositories, modeled on GitHub Actions. The forge does not run the jobs itself: you have to install and register a separate runner (Gitea Runner or Forgejo Runner), using a token provided by the forge. A runner executes the repositories' code: the Forgejo documentation describes it as a serious risk for the machine and network hosting it, and the Gitea documentation advises placing it on a different machine from the forge. Start without Actions, then add an isolated runner by following the official documentation, and do not open it to repositories from people you do not know.

Backing up. The Gitea documentation advises stopping the instance during the backup, so the database and repositories stay consistent. With SQLite, everything is in the forgejo folder:

cd /opt/forgejo
sudo docker compose stop
sudo tar czf /root/forgejo-$(date +%F).tar.gz forgejo
sudo docker compose start

With PostgreSQL, add its data folder to the archive, again with the instance stopped. The forgejo dump command (gitea dump for Gitea) also produces a full archive; the documentation explains how to run it inside the container. Copy the archives off the VPS: they contain all your code.

Updating. Back up, read the release notes, change the image tag in docker-compose.yml, then:

sudo docker compose pull
sudo docker compose up -d

With Forgejo, moving from one major version to the next requires a human check: read its upgrade guide before changing the number. To be warned if the forge stops answering, add it to Uptime Kuma.

06

On CloudFive

CloudFive does not offer a managed Git forge: you install Gitea or Forgejo yourself on a VPS, with root access. The Ryzen VPS, from €5.99 per month, suits a personal or team forge well:

  • an AMD Ryzen 9 9950X, with DDR5 memory and NVMe storage;
  • Docker and Docker Compose install with the official script, nesting being enabled on our VPS (see the Docker VPS page);
  • a dedicated IPv4 address and basic DDoS protection included;
  • snapshots from the customer area, to take before an update.

If you add a runner for Actions, give it a second VPS rather than running it next to the forge. Servers are in France, on our own network, monthly with no commitment, with support in French 7 days a week by tickets, on Discord and by phone.

07

Frequently asked questions

What is the difference between Gitea and Forgejo?

Forgejo was born in late 2022 as a community fork of Gitea, under the umbrella of the Codeberg e.V. association, and became an independent fork in early 2024. Gitea is run by a company. Both install and work in very similar ways; moving from Gitea to Forgejo is only supported from Gitea 1.22 or earlier.

Which ports do Gitea and Forgejo use?

The web interface listens on port 3000 and the built-in SSH server on the container's port 22, published on another VPS port, often 222, to leave port 22 to the system's SSH. Publish port 3000 on 127.0.0.1 and go through an HTTPS reverse proxy.

SQLite or PostgreSQL for Gitea or Forgejo?

SQLite is the default choice: a simple file, with no separate service, which is enough for personal use or a small team. PostgreSQL suits a busier forge better, with an extra database container. The choice is made in the setup wizard or through environment variables.

How do I clone over SSH on a port other than 22?

Put the port in the address, for example ssh://git@git.example.com:222/utilisateur/projet.git. You can also add a Host block in ~/.ssh/config with Port 222 and User git. The SSH port set in the wizard must be the same, so the forge shows the right clone addresses.

How do I back up a Gitea or Forgejo forge?

Stop the instance, archive the data folder (and the PostgreSQL one if you use it), then restart it and copy the archive off the VPS. The forgejo dump or gitea dump command also produces a full archive.

Support CloudFive AI

An answer right away, a real team behind it.

CloudFive AI answers you at any hour, in seconds. When it doesn’t know, or as soon as you ask, the team that runs the machines takes over. No offshore call centre.

  • TicketThe team replies in under 2 hours, 7 days a week.
  • CloudFive AIAt any hour, on ia.cloudfive.fr, Discord and in your customer area.
  • DiscordThe team, the AI and other customers, in the help channel.
  • Your data stays with usAI runs on our servers in France; e-mails, IPs and passwords are masked.
A ticket in the customer area: a customer’s question about a Minecraft plugin, and the CloudFive team’s reply
A real ticket in the customer area, answered by the team (demo account; shown in French).
CUSTOMER AREA · APP

Your servers.
At your fingertips.

Restart a server, watch its resources live, pay an invoice or open a ticket — and get an alert when something goes wrong.

  • The status of all your services at a glance
  • Blocked attacks, filtered traffic, monthly peak
  • A notification when a server goes down or an invoice is due

App coming soon · in the meantime, everything works in your browser at manager.cloudfive.fr

The CloudFive app: the list of your services, with their status
The CloudFive app: the home screen, your services’ status, blocked attacks and an invoice to pay