Gitea is a self hosted git-server with an UI that is similar to Github. It is written in Go and is therefore very lightweight. This post describes how to install and update it. Please also refer to the very well written Gitea Documentation.
Download gitea from here: https://dl.gitea.io/gitea/
Execute binary to generate needed folders and bam - you are done! :)
Now you can configure it to your needs by creating a
In the following I compiled some of the most important settings I used. I am using sqlite for database as it doesn`t require me to run a seperate MySQL or other database and works just fine for little load. Also I added a proxy, so the root url had to be adapted.
APP_NAME = Gogs RUN_USER = user RUN_MODE = prod [database] DB_TYPE = sqlite3 HOST = 127.0.0.1:3306 NAME = gogs USER = root PASSWD = SSL_MODE = disable PATH = /srv/yourpath/gogs.db [repository] ROOT = /srv/yourpath/gogs-repositories [server] DOMAIN = localhost HTTP_PORT = 3030 ROOT_URL = https://git.yourdomain.com/ DISABLE_SSH = false SSH_PORT = 22 START_SSH_SERVER = false OFFLINE_MODE = false ...
Add it to autostart by adding a file
[Unit] Description=Gitea After=syslog.target After=network.target After=mariadb.service mysqld.service postgresql.service memcached.service redis.service [Service] # Modify these two values and uncomment them if you have # repos with lots of files and get an HTTP error 500 because # of that ### #LimitMEMLOCK=infinity #LimitNOFILE=65535 Type=simple User=bastisk Group=bastisk WorkingDirectory=/srv/gitea # REPLACE WITH CORRECT PATH ExecStart=/srv/gitea/gitea web # REPLACE WITH CORRECT PATH Restart=always Environment=USER=user HOME=/home/user # REPLACE WITH CORRECT USER AND HOME ENV # Some distributions may not support these hardening directives. If you cannot start the service due # to an unknown option, comment out the ones not supported by your version of systemd. ProtectSystem=full PrivateDevices=yes PrivateTmp=yes NoNewPrivileges=true [Install] WantedBy=multi-user.target
Start it as service and enable it to start at reboot
systemctl start gitea systemctl enable gitea
Updating is as simple as downloading an updated binary from https://dl.gitea.io/gitea/ and replacing the old one. Afterwards restart the service.
systemctl restart gitea