- AUR - Release package
masterbranch package GitHub master branch AUR - Git
Each package provides multiple options for configuring the backend/storage for the service, see #Configuration
Installing Gogs from the AUR instead of manually has the added benefit that lots of steps have been taken care of for you (e.g. permissions and ownership for files, etc).
Also before installing the Gogs package from the AUR, you need to choose a database backend if you are planning to host Gogs on the same machine as the database:
- SQLite: #SQLite. - For configuration of Gogs with SQLite see
- PostgreSQL: PostgreSQL#Installation to set it up and start the daemon and for configuration of Gogs with PostgreSQL see #PostgreSQL. - Read
- MariaDB: MariaDB#Installation to set it up and start the daemon and for configuration of Gogs with MariaDB see #MariaDB. - Read
If you plan to use SSH to interact with your repositories, make sure to add the
gogs user to the
AllowUsers entry in
gogs.service, you can access the running service over the url
http://[server]:3000. At first load, you will be redirected to the installation page where you can configure some options. In order to be able to save changes made using the initial configuration page the permissions of the configuration directory (owned by root) will have to be modified (either temporary or permanently), for example:
# chown -R gogs:gogs /etc/gogs/
In the configuration file
/etc/gogs/app.ini, you can change more values (for example the port number).
The Gogs configuration file is located at
/etc/gogs/app.ini. When you want to edit a configuration option, you need to edit this file and restart the Gogs service before changes will take effect.
In order to interact with the git repositories using ssh, and to be able to use the uploaded public keys:
/var/lib/gogs/.ssh(see also documentation[dead link 2020-03-29 ⓘ]), and ensure that
/var/lib/gogs/.sshand hand over ownership to the
> mkdir -p /var/lib/gogs/.ssh > chown -R gogs:gogs /var/lib/gogs/.ssh
Public keys will be added by the
gogs user to
Since when installing
gogs user will have a
/sbin/nologin shell, so you need to put in a
# usermod -s /bin/bash gogs
.gitignore and license files
A set of gitignore and license files are included in the package and are stored at
You can get or create your own .gitignore files here.
PATH variable in the
[database] section) for the SQLite database file. To be consistent with the other settings, use
/var/lib/gogs/data/gogs.db (see also issue 4298).
Installand select Postgresql on the installation page.
# su - postgres -c # createuser -P gogs # createdb -O gogs gogs
Installand setup a user and database:
# CREATE DATABASE `ishouldchangethisdatabasename` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`; # CREATE USER 'ishouldchangethisusername'@'localhost' IDENTIFIED BY 'ishouldchangethispassword'; # GRANT ALL ON `ishouldchangethisdatabasename`.* TO 'ishouldchangethisusername'@'localhost';
On the installation page select mysql and insert your configured user, password and database name.
The current package (gogs-git* and gogs>=0.4.2) support custom themes. The location for Gogs themes is
/usr/share/themes/gogs/. Gogs comes with one default theme, but you can easily create a own theme. Just copy the default
theme directory and change whatever you want. In the
template directory are the HTML templates. The current selected theme can be changed over the
app.ini configuration parameter
STATIC_ROOT_PATH. Changed it with the absolute path to the new theme.
Restart after Upgrade
To automate this the following pacman hook can be inserted at
[Trigger] Type = Path Operation = Upgrade Target = usr/share/gogs/gogs [Action] Description = Restart gogs... When = PostTransaction Exec = /usr/bin/systemctl try-restart gogs.service
If you are using a non-default port for your SSH server, you will get not-so-pretty clone URLs. You can make gogs start its own SSH server, listening on port 22.
Allow gogs binary to bind privileged ports:
# setcap CAP_NET_BIND_SERVICE=+eip /usr/share/gogs/gogs
Configure gogs SSH server in
START_SSH_SERVER = true SSH_PORT = 22 SSH_LISTEN_PORT = 22