Gogs is a lightweight self-hosted Git service. Since it has almost no dependencies, you can setup your own Git service in almost no time. All you need is a small server for hosting it. I am using a Raspberry Pi 2 with Raspbian to host my private Gogs Git service. In this small post I’ll show you how.


Start by updating all the apt-packages:

sudo apt-get update
sudo apt-get upgrade

Also ensure Git is installed on your server:

sudo apt-get install git

Create a user

Before installing Gogs we will first create a new dedicated user for running Gogs:

sudo adduser --disabled-login --gecos 'Gogs' git

Install Gogs

First of all switch to the new user named git:

sudo su - git

Now fetch the latest binary package of Gogs from the download page for your operating system:

wget https://dl.gogs.io/gogs_v0.9.13_raspi2.zip
unzip gogs_v0.9.13_raspi2.zip

There are no further steps required. We just need to configure Gogs as a Systemd service, so it will automatically start when the server starts or reboots. Gogs alredy comes with a well preconfigured Systemd script. So let’s use it:

sudo cp /home/git/gogs/scripts/systemd/gogs.service /etc/systemd/system/
sudo systemctl enable gogs
sudo systemctl start gogs

Gogs should now start a installer and configuration page on http://localhost:3000/. Open the page in your browser and configure it your needs. In most cases the default configuration is sufficient to run Gogs. Anyways, detailed installation information are available in the documentation.

If you plan to bind Gogs to a port below 1024, it might be necessary to grant permission to the executable first:

sudo setcap 'cap_net_bind_service=+ep' /home/git/gogs/gogs

For further configuration options and tweeks take a look at the Configuration Cheat Sheet. Changes to the custom/conf/app.ini file required a restart of the Gogs service:

sudo systemctl stop gogs
sudo systemctl start gogs