4.1 KiB
Gitea
TL;DR
Setup
# Install from source.
git clone 'https://github.com/go-gitea/gitea' -b 'release/v1.22' && cd 'gitea' \
&& TAGS='bindata sqlite sqlite_unlock_notify' make build
# Install as package.
apk add 'gitea'
brew install 'gitea'
emerge -aqv 'gitea'
pacman -S 'gitea'
pkg install 'gitea'
# Kubernetes
helm repo add 'gitea-charts' 'https://dl.gitea.com/charts/'
helm upgrade --install 'gitea' 'gitea-charts/gitea'
Usage
# Start after installation from source.
./gitea web
Installation
Container
Docker compose file.
The git user has UID and GID set to 1000 by default.
Change those in the compose file or whatever.
One can optionally define the administrative user during the initial setup.
If no administrative user is defined in that moment, the first registered user becomes the administrator.
Configuration
Refer the Configuration cheat sheet.
LFS
Enable the built-in LFS support by updating the app.ini configuration file:
[server]
LFS_START_SERVER = true
[lfs]
PATH = /home/gitea/data/lfs # defaults to {{data}}/lfs
HTTPS certificates
Refer HTTPS setup to encrypt connections to Gitea.
If the certificate is signed by a third party certificate authority (i.e. not self-signed), then cert.pem should
contain the certificate chain.
The server certificate must be the first entry in cert.pem, followed by the intermediaries in order (if any).
The root certificate does not have to be included as the connecting client must already have it in order to
establish any trust relationship.
The file path in the configuration is relative to the GITEA_CUSTOM environment variable when it is a relative path.
Self-signed certificate
-
Generate a self signed certificate:
gitea cert --host 'git.host.fqdn' docker compose exec server gitea cert --host 'git.host.fqdn' -
Change the
app.iniconfiguration file:[server] PROTOCOL = https ROOT_URL = https://git.host.fqdn:3000/ HTTP_PORT = 3000 CERT_FILE = /path/to/cert.pem KEY_FILE = /path/to/key.pem
ACME certificate
Defaults to using Let's Encrypt.
Change the app.ini configuration file:
[server]
PROTOCOL=https
DOMAIN=git.example.com
ENABLE_ACME=true
ACME_ACCEPTTOS=true
ACME_DIRECTORY=https
ACME_EMAIL=email@example.com # can be omitted here and provided manually at first run, after which it is cached
Set up HTTP redirection
Gitea server is able to listen on one single port. Enable the HTTP redirection service to redirect HTTP requests to the HTTPS port:
[server]
REDIRECT_OTHER_PORT = true
PORT_TO_REDIRECT = 3080 # http port to be redirected to https
When using Docker, make sure this port is published.
Further readings
Alternatives: