Gogs
Gogs (Go Git Service) is a Self Hosted Git service, which was written in the Go programming language.
Contents
Packages
- gogsAUR - Release package
- gogs-gitAUR - Git
master
branch package GitHub master branch - gogs-git-devAUR - Git
dev
branch package GitHub dev branch
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).
Installation
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're planning to host Gogs it on the same machine as the database:
- SQLite: sqlite - For configuration of Gogs with SQLite see #SQLite.
- PostgreSQL: postgresql - Read PostgreSQL#Installing PostgreSQL to set it up and start the daemon and for configuration of Gogs with PostgreSQL see #PostgreSQL.
- MariaDB: mariadb - Read MariaDB#Installation to set it up and start the daemon and for configuration of Gogs with MariaDB see #MariaDB.
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 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).
Configuration
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.
Database
SQLite
Install sqlite and select SQLite on the installation page.
PostgreSQL
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"
MariaDB
Install mariadb and 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.
SMTP
oAuth
Logging
Caching
Theme
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
:
[Trigger] Type = File Operation = Upgrade Target = usr/share/gogs/gogs [Action] Description = Restart gogs... When = PostTransaction Exec = /usr/bin/systemctl try-restart gogs.service