Gogs is a free, self-hosted Git service written in Go. It gives you a private GitHub-like environment on your own server, complete with repository browsing, issue tracking, pull requests, team management, and a built-in wiki. It is a lighter-weight alternative to GitLab and uses significantly less memory. Gogs runs comfortably on a small VPS or even a Raspberry Pi.
This guide walks you through installing Gogs on Ubuntu 18.04 from the official binary, running it as a systemd service, and configuring Nginx as an SSL reverse proxy.
<strong>Prerequisites:</strong> You need sudo access. This guide uses SQLite as the database. Install it if it is not already present:bashsudo apt install sqlite3
Install Git and create the service user
Install Git first:
bashsudo apt update && sudo apt install git
Create a dedicated system user to run the Gogs process. This account has no login password and cannot SSH in directly, which limits the attack surface if the service is ever compromised:
bashsudo adduser --system --group --disabled-password --shell /bin/bash --home /home/git --gecos 'Git Version Control' git
Download and set up the Gogs binary
Check the Gogs download page for the latest release and download the archive. Replace the VERSION value if a newer release is available:
bashVERSION=0.11.86wget https://dl.gogs.io/${VERSION}/gogs_${VERSION}_linux_amd64.tar.gz -P /tmpsudo tar xf /tmp/gogs_*_linux_amd64.tar.gz -C /home/gitsudo chown -R git: /home/git/gogs
Start the Gogs service
Gogs ships with a pre-built systemd unit file. Copy it to the system directory, then start and enable the service:
bashsudo cp /home/git/gogs/scripts/systemd/gogs.service /etc/systemd/system/sudo systemctl start gogssudo systemctl enable gogs
Open http://YOUR_SERVER_IP:3000 in a browser. The web installer prompts you to configure:
/home/git/gogs/gogs.db/home/git/gogs-repositories), set Run User to git, and enter your domain or server IP3000 unless you need a different portClick Install Gogs. The process finishes instantly and redirects you to the login page. Click Sign up now to register. The first account created is automatically assigned admin privileges.
Running Gogs behind Nginx with a valid SSL certificate is strongly recommended for any public-facing server. You will need a domain name pointing to the server and a Let’s Encrypt certificate already installed on Nginx.
Configure Nginx to proxy port 3000 over HTTPS, then update the Gogs configuration to use the new domain:
bashsudo nano /home/git/gogs/custom/conf/app.ini
Update the server section:
[server]DOMAIN = gogs.example.comROOT_URL = https://gogs.example.com/
Restart Gogs to apply the change:
bashsudo systemctl restart gogs
Gogs also supports email notifications via any SMTP provider. Configure the [mailer] block in app.ini with your SMTP credentials and restart the service. For Slack notifications, use Gogs’s built-in webhook integration under each repository’s settings page.
Upgrading Gogs: Stop the service, rename the old directory, download and extract the new binary, copy custom, data, log, and gogs.db from the old directory using rsync, then restart Gogs.
Gogs is now installed and running on your Ubuntu 18.04 server. Create your first repository, invite your team, and start using your private Git server today. Leave a comment below if you run into any issues.