Log inSign up

Gogs, a minimal Git service on your VPS

Download the Gogs release archive, unpack it into /home/git/gogs as a dedicated git user, create a MariaDB database, install the bundled systemd unit, and proxy git.example.net to port 3000 with Nginx and a Certbot certificate. Finish setup in the web installer, then bind Gogs to 127.0.0.1 and close registration in custom/conf/app.ini.

Topic: Self-hosted apps · Tested on: Ubuntu 24.04 and 22.04, Debian 12 and 13 · Updated 2026-12-03

When is Gogs the right choice?

Gogs fits when you want the smallest possible Git web service: repositories, issues, pull requests, wikis and webhooks in one binary that idles in well under 100 MB of memory. It has fewer features than its descendants Gitea and Forgejo (no built-in CI or package registry) and its releases come less often, so check the project's release page and decide whether that pace suits you.

You need:

  • Ubuntu 24.04/22.04 or Debian 12/13 with a sudo user.
  • DNS records for git.example.net.
  • Git and a database. MariaDB is used here; PostgreSQL and SQLite also work.
sudo apt update && sudo apt install -y git wget tar mariadb-server
git --version
sudo systemctl enable --now mariadb

How do you create the git user and database?

Create a system account named git that will own the program and repositories, then a MariaDB database with full UTF-8 support.

sudo adduser --system --shell /bin/bash --gecos 'Gogs' \
  --group --disabled-password --home /home/git git
sudo mariadb-secure-installation
sudo mariadb
CREATE DATABASE gogs CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'gogs'@'localhost' IDENTIFIED BY 'Long-Random-Secret';
GRANT ALL PRIVILEGES ON gogs.* TO 'gogs'@'localhost';
FLUSH PRIVILEGES;
EXIT;

The login shell must stay /bin/bash, because Git over SSH runs commands as this user through the keys Gogs writes to /home/git/.ssh/authorized_keys.

How do you download and install the release?

Fetch the Linux archive for your architecture, unpack it into the git home, and install the systemd unit that ships inside it.

VER=0.13.3   # replace with the newest release number
cd /tmp
wget https://dl.gogs.io/$VER/gogs_${VER}_linux_amd64.tar.gz
sudo tar -xzf gogs_${VER}_linux_amd64.tar.gz -C /home/git
sudo chown -R git:git /home/git/gogs
sudo -u git /home/git/gogs/gogs --version
sudo cp /home/git/gogs/scripts/systemd/gogs.service /etc/systemd/system/
grep -E 'User|WorkingDirectory|ExecStart' /etc/systemd/system/gogs.service

The shipped unit expects /home/git/gogs and user git, which matches this layout; the grep confirms it. If the file mentions a different database service in its After= line, change it to mariadb.service. Then start it:

sudo systemctl daemon-reload
sudo systemctl enable --now gogs
sudo ss -ltnp | grep 3000

How do you put Nginx and HTTPS in front?

Create a proxy site for the host name, get a certificate with Certbot, and keep port 3000 closed in the firewall.

sudo apt install -y nginx certbot python3-certbot-nginx
sudo tee /etc/nginx/sites-available/gogs >/dev/null <<'EOF'
server {
    listen 80;
    listen [::]:80;
    server_name git.example.net;
    client_max_body_size 256M;
    location / {
        proxy_pass http://127.0.0.1:3000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}
EOF
sudo ln -s /etc/nginx/sites-available/gogs /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
sudo ufw allow OpenSSH
sudo ufw allow 'Nginx Full'
sudo ufw enable
sudo certbot --nginx -d git.example.net --redirect

Raise client_max_body_size if people push large files over HTTPS. The Nginx reverse proxy guide explains each header.

How do you complete the web installer?

Open https://git.example.net; the first visit shows the install form, where you enter the database and the public address.

  • Database: MySQL, host 127.0.0.1:3306, user gogs, the password you set, database gogs.
  • Run user: git. Domain: git.example.net. SSH port: 22. HTTP port: 3000.
  • Application URL: https://git.example.net/.
  • Admin account: open the optional section and create it now, so nobody else can claim the first account.

Gogs writes /home/git/gogs/custom/conf/app.ini. Then tighten it with sudoedit:

[server]
HTTP_ADDR = 127.0.0.1

[auth]
DISABLE_REGISTRATION = true
sudo systemctl restart gogs
sudo ss -ltnp | grep 3000

The listener should now show 127.0.0.1:3000 only. Older 0.11 releases used the [service] section for the registration switch, so match the section names your release documents.

How do you configure outgoing mail?

Enable the email section with an authenticated relay on port 587 and restart; Gogs uses it for account activation and notifications.

[email]
ENABLED = true
HOST = smtp.example.net:587
FROM = Gogs <git@example.net>
USER = git@example.net
PASSWORD = change-me

Then use the admin panel option to send a test message. Sending straight to recipients on port 25 is not something to rely on from a VPS; ask support by ticket first if you need it, and use the relay meanwhile. The SMTP relay guide covers SPF and DKIM so messages land in inboxes.

How do you back up and upgrade Gogs?

Use the built-in backup command, and upgrade by unpacking the new release next to your custom, data and log folders.

sudo -u git mkdir -p /home/git/backups
cd /home/git/gogs
sudo -u git ./gogs backup --config custom/conf/app.ini --target /home/git/backups
ls -lh /home/git/backups

The archive holds the database, repositories and custom files; restore with gogs restore --from FILE. To upgrade:

sudo systemctl stop gogs
sudo mv /home/git/gogs /home/git/gogs-old
sudo tar -xzf /tmp/gogs_NEW_linux_amd64.tar.gz -C /home/git
sudo cp -a /home/git/gogs-old/custom /home/git/gogs-old/data /home/git/gogs-old/log /home/git/gogs/
sudo chown -R git:git /home/git/gogs
sudo systemctl start gogs

Read the changelog first, keep gogs-old until the new version runs, and copy backups off the server. The daily backup add-on adds a full-disk layer.

What should you check when something fails?

Gogs writes its own log under /home/git/gogs/log/, and systemd keeps start errors in the journal.

sudo journalctl -u gogs -n 50 --no-pager
sudo tail -n 50 /home/git/gogs/log/gogs.log
  • Installer reappears: INSTALL_LOCK is false or the service runs from a different folder than the config.
  • SSH asks for a password: the key is missing in /home/git/.ssh/authorized_keys, or the folder permissions are too open (700 for .ssh, 600 for the file).
  • Clone URLs show port 3000: ROOT_URL in [server] is wrong.

Plans that fit this guide

Base city prices. Every plan includes a dedicated IPv4 address, IPv6, full root and all 18 images.

All prices
PlanFits becauseSizeMonthlyOrder from
A1-1personal Git service1 vCPU, 1 GB RAM, 25 GB NVMe$3.60/mo$43.20 for 12 months
A1-2small team with MariaDB1 vCPU, 2 GB RAM, 50 GB NVMe$7.20/mo$43.20 for 6 months

Questions about Gogs Git service

How does Gogs compare with Gitea and Forgejo?

Gitea started as a fork of Gogs, and Forgejo later forked Gitea. Both add CI, packages and more admin options; Gogs stays smaller. See the Gitea guide if you need those features.

Can I use SQLite instead of MariaDB?

Yes, choose SQLite3 in the installer. It suits a single user, needs no database server, and backs up with the same command.

Does Gogs have a Docker image?

Yes, an official image exists. It runs its own SSH server inside the container, so you map a second port such as 10022 for clones.

How much memory does it need?

Very little: Gogs plus MariaDB fit comfortably in 1 GB for personal or small team use.

Can I migrate from Gogs to Gitea later?

Yes, Gitea documents a path from Gogs, and both can import repositories over HTTPS with a token.