Raspberry Pi - Gitea

The following instructions cover how to install Gitea onto a Raspberry Pi.

Gitea is a software package which enables the creation and management of repositories based on Git. When run on a RPi it provides a web based front end for full control over your repositories. Multi-user/team support is built in.

For further information pleae visit the Gitea website.

Installation

Install all the latest updates:

sudo apt-get update
sudo apt-get upgrade
sudo reboot

Install the following required packages:

sudo apt install git mariadb-server -y
sudo mysql_secure_installation

Create a new user called “git”:

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

Create a new mysql database:

sudo mysql -u root

CREATE DATABASE gitea;
GRANT ALL PRIVILEGES ON gitea.* TO 'gitea'@'localhost' IDENTIFIED BY 'gitea';
FLUSH PRIVILEGES;
EXIT;

Install Gitea on the RPi inside the ‘Git’ users directory:

sudo su git       (sudo su -s /bin/bash git)
cd /home/git
mkdir gitea
cd gitea
wget https://dl.gitea.io/gitea/1.17.0/gitea-1.17.0-linux-arm-5 -O gitea
chmod +x gitea
exit
cd ~

Then edit the Gitea settings file:

sudo nano /etc/systemd/system/gitea.service

[Unit]
Description=Gitea (Git with a cup of tea)
After=syslog.target
After=network.target

[Service]
LimitMEMLOCK=infinity
LimitNOFILE=65535
RestartSec=2s
Type=simple
User=git
Group=git
WorkingDirectory=/home/git/gitea
ExecStart=/home/git/gitea/gitea web
Restart=always
Environment=USER=git
HOME=/home/git

[Install]
WantedBy=multi-user.target

Enable and start the Gitea service:

sudo systemctl enable gitea.service
sudo systemctl start gitea.service

First time setup

Access the Gitea web front end using a web server by visiting “pi5.local:3000”

On the first launch you will have the option of changing a number of settings:

Password “gitea"
User “gitea"
change localhost to pi5.local
root url = pi5.local:3000

Raspberry Pi is a trademark of Raspberry Pi Ltd