gitea install guide

Why use gitea?

What are the differences to github / gitlab? -> https://docs.gitea.io/en-us/comparison/

Gitea is a "github clone" that you can host yourself. With this you can (for example) host your own github locally without anyone having access to it. With github you have to pay to host private repositories.
Gitea can also run on a very small raspberry pi zero w without any performance issues. (The zero w has a single core ARM6 Processor)
It is written in go. The website is https://gitea.io/en-us/

Installation

Requirements: Have git installed (example: sudo apt-get install git)

Get the latest version of gitea (binary) from gitea (https://dl.gitea.io/gitea/) and make it executeable.
Example with version 1.13.0 on x64 linux (newest version as of 2020.12.26):

wget -O gitea https://dl.gitea.io/gitea/1.13.0/gitea-1.13.0-linux-amd64
chmod +x gitea

Add a user for gitea:
adduser \
--system \
--shell /bin/bash \
--gecos 'Git Version Control' \
--group \
--disabled-password \
--home /home/git \
git

Create directory structure for gitea:
mkdir -p /var/lib/gitea/{custom,data,log}
chown -R git:git /var/lib/gitea/
chmod -R 750 /var/lib/gitea/
mkdir /etc/gitea
chown root:git /etc/gitea
chmod 770 /etc/gitea

Now "Install" gitea:
cp gitea /usr/local/bin/gitea

Create service for gitea:
Download https://github.com/go-gitea/gitea/blob/master/contrib/systemd/gitea.service and move it to /etc/systemd/system/gitea.service
wget https://github.com/go-gitea/gitea/blob/master/contrib/systemd/gitea.service
sudo cp gitea.service /etc/systemd/system/gitea.service

Now start gitea:
sudo systemctl enable gitea --now

The default port for gitea is 3000.

If you don't know what database you want:
Use SQLite3 if you don't have a lot of people working at once. SQLite3 is more minimalistic, but can't handle concurrent writing very well.
With MySQL, you need to have the mysql-server installed and set up with a new user and database.
With SQLite3, you don't have to install or setup anything, because the database is saved in a file locally.
Source: https://stackoverflow.com/a/6914810

Reverse-proxy via nginx

If you want to reach it via example.com/git instead of example.com:3000 then you can use a reverse proxy. This example requires you to have nginx installed.
Simply add the following to your server block:
location /git/ {
  proxy_pass http://localhost:3000/;
}
If you want to setup gitea via this reverse-proxy then you also have to do the following:
(You do not have to do this if you visit it via port 3000 to configure it!)
Change the ROOT_URL line in your gitea config (located at /etc/gitea/app.ini with Debian 10):
...
[server]
PROTOCOL = http
DOMAIN = localhost
ROOT_URL = http://localhost:3000/git/
...
If this line doesn't exist then create the code block from above and save the file.

Then check the config via sudo nginx -t.
If there are no problems you can reload the config via sudo nginx -s reload.