Gitea

Gitea is a community managed fork of Gogs, lightweight code hosting solution written in Go and published under the MIT license.

Installation

Install the gitea or gitea-gitAUR package.

Gitea requires the use of a database backend, the following are supported:

Configuration

The user configuration file is located at /etc/gitea/app.ini and is created the first time Gitea is run. There is also an example configuration file located at /etc/gitea/app.example.ini.

See the Gitea docs for more configuration examples.

PostgreSQL

Install and configure PostgreSQL.

Choose between TCP or UNIX Socket, and jump to the corresponding section.

Note: When Gitea and PostgreSQL are on the same machine, you should use a Unix socket, as it is faster and more secure.

With TCP socket

Create the new user while connecting to the server as user (you will be prompted for a password for the new user):

[postgres]$ createuser -P gitea

Create the Gitea database, owned by user:

[postgres]$ createdb -O gitea gitea

PostgreSQL#Configure PostgreSQL to be accessible from remote hosts

Verify it works:

$ psql --host=ip_address --dbname=gitea --username=gitea --password

Configure Gitea either through the first-run installer or update app.ini:

With Unix socket

Create the new user while connecting to the server as user:

[postgres]$ createuser gitea

Create the Gitea database, owned by user:

[postgres]$ createdb -O gitea gitea

Setup the Unix socket by adding the following line to :

Restart postgresql.service.

Verify it works:

[gitea]$ psql --dbname=gitea --username=gitea

Configure Gitea either through the first-run installer or update app.ini:

MariaDB/MySQL

The following is an example of setting up MariaDB, setting your desired password:

Try connecting to the new database with the new user:

$ mysql -u gitea -p -D gitea

Configure MariaDB either through the first-run installer or update app.ini:

Usage

Start/enable , the webinterface should listen on http://localhost:3000.

When running Gitea for the first time, it should redirect to .

Tips and tricks

Local Shell Client (tea)

With you can use the official cli-client of gitea. More information can be found at https://gitea.com/gitea/tea

Enable SSH Support

Make sure SSH is properly configured and running.

Setup your domain

You might want to set SSH_DOMAIN, e.g.:

Configure SSH

By default, Gitea will run as the user ; this account will also be used for ssh repository access. For ssh access to work, you have to enable PAM. Alternatively, you might have to unlock service account.

If you use in your SSH configuration, add to it, e.g.:

Restart if you use it (nothing to do if you use sshd.socket).

Disable HTTP protocol

By default, the ability to interact with repositories by HTTP protocol is enabled. You may want to disable HTTP-support if using SSH, by setting to .

Binding on restricted ports

If you use the built-in SSH server and want Gitea to bind it on port 22, or if you want to bind Gitea webserver directly on ports 80/443 (that is in a setup without proxy), you will need to add a drop-in systemd unit override:

Enable Dark Theme

In the ui section, you can set the to arc-green for making the web interface use a dark background.

Configure nginx as reverse proxy

The following is an example of using nginx as reverse proxy for Gitea over unix socket (you need to provide the SSL certificate):

Update the and section of app.ini:

For additional information and examples, see the Reverse Proxies section on the Gitea documentation website .

Setup for custom data directory

As of now, you cannot use a custom path like /srv/gitea as your server home, since the shipped unit file marks everything read-only.

To enable these custom paths, create a drop-in snippet with your server home directory as a new directive:

Then do a daemon-reload and restart for the changes to take effect.

Troubleshooting

Database error on startup after upgrade to 1.5.0

A problem can appear after the upgrade to 1.5.0. The service will not start, and the following error is present in the logs:

To fix this problem, run the following command as the `root` user on your MySQL/MariaDB server

$ mysql -u root -p
MariaDB> set global innodb_large_prefix = `ON`;

gitea should stop complaining about key size and startup properly.

gollark: It's a type of monoid.
gollark: The bees do not say anything about this "homestuck adaptation".
gollark: You should all do this, it's great.
gollark: https://media.discordapp.net/attachments/426116061415342080/899376149518508113/image0.png?width=448&height=623
gollark: As far as I know, as well as developmental differences, you would have different DNA due to different random selection from the pairs of genes you have now.

See also

This article is issued from Archlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.