From ArchWiki
Revision as of 13:47, 15 August 2016 by Mic92 (talk | contribs) (pacman hook)
Jump to navigation Jump to search

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: Work in progress (Discuss in Talk:Gogs#)

Gogs (Go Git Service) is a Self Hosted Git service, which was written in the Go programming language.


In all three package is sqlite, redis and memcache activate for compile. To use it, you need to edit the configuration file app.ini (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).

Make sure you perform a system upgrade (pacman -Syu) before installing Gogs from AUR and that you have installed the base-devel group, or you may face problems installing Gogs because base-devel packages are not required to be listed as dependencies in PKGBUILD files.

Also before installing the Gogs package from the AUR, you need to choose a database backend if you're planning to host Gogs it on the same machine as the database:

If you plan to use SSH to interact with your repositories, make sure to add the gogs user to the AllowUsers entry in /etc/ssh/sshd_config.

First start

After starting of the Gogs service (systemctl start gogs.service), you can access the running service over the url http://[server]:3000. At the first execute, you will redirect to the installation page. Here you can configure some minor configuration options. In the configuration file /srv/gogs/conf/app.ini, you can change more values (for example the port number).


After the first start, Gogs created a own configuration file in the directory /srv/gogs/config. When you want to edit a configuration option, you need to edit this file.

.gitignore and license files

Add the files into the directory /srv/gogs/conf/gitignore or /srv/gogs/conf/license. When the directory not exist, you need to created it in the first step.

You can get or create own .gitignore files on this page.



Install sqlite and select SQLite on the installation page.


Install postgresql and select Postgresql on the installation page.

# su - postgres -c "initdb --locale en_US.UTF-8 -D '/var/lib/postgres/data'"
# su - postgres -c "createuser --interactive"
# name: gogs
# su - postgres -c "createdb -U gogs gogs"







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 what every you want. In the public directory is every javascript, stylesheet and font file and 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

Gogs needs to be restarted after every upgrade because the paths of javascript/css assets will change and therefor break the website. To automate this the following pacman hook can be inserted to /etc/pacman.d/hooks/gogs.hook:

 Type = File
 Operation = Upgrade
 Target = usr/share/gogs/gogs
 Description = Restart gogs...
 When = PostTransaction
 Exec = /usr/bin/systemctl try-restart gogs.service

See also