Skip to content

Instantly share code, notes, and snippets.

@KageKirin
Last active January 1, 2023 18:13
Show Gist options
  • Save KageKirin/2a4a1ab8e89b08fdc8f5b698eeeb16b5 to your computer and use it in GitHub Desktop.
Save KageKirin/2a4a1ab8e89b08fdc8f5b698eeeb16b5 to your computer and use it in GitHub Desktop.
Running a Git server on a Raspberry Pi (Gitea version)

Running a Git server on a Raspberry Pi (Gitea version)

Gitea is small Git server written in Go that comes with a basic feature set, similar to its resource-hungry cousins GitLab and GitHub.

Since it doesn't need much resources, Gitea is perfect for running on a Raspberry Pi.

Preparation

We want a special user for gitea, and git-related operations: git. (Mostly b/c this will allow us to access repos via ssh with the format git@my-raspi-git).

So,

## create user
sudo adduser git

## add user to group 'users'
sudo usermod -a -G users git

## create group 'gitusers'
sudo groupadd gitusers

## add 'git' to 'gitusers'
sudo usermod -a -G gitusers git

Installation

There are several ways to install Gitea:

  • APT (through a few more registries)
  • snap
  • from source

Installation via APT

We will be going over the easiest installation: via apt.

Awesome-Gitea lists 2 package registries for Debian, but we will use the Raspbian Addons, since it's the one explictly made for Raspbian.

Install Raspbian Addons

The Raspbian installation guide details how to install the additional APT registries.

python3 <(curl -fSsL https://scripts.raspbian-addons.org/utils/repo.py)

This is fine. Just select the default registries and update the cache.

sudo apt update

Install Gitea

Installing Gitea is a breeze through APT:

sudo apt install gitea

Installation via SNAP

Installing through snap is equally straightforward, following the installation instructions at snapcraft.io.

Given that snap was installed with

sudo apt install snapd
sudo reboot
sudo snap install core

we install gitea through snap with

sudo snap install gitea

Installation from source

Installing from source following the official guide requires a few more dependencies:

  • Go
  • npm
  • make
  • git

The build command is

TAGS="bindata sqlite sqlite_unlock_notify" make build

Configuration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment