Courtesy MUSTGOPHOTO / SHUTTERSTOCK

Gitea: a self-hosted git solution

Mehran Ghamaty
1 min readDec 5, 2023

Getting tired of Github and BitBucket for one reason or another, I decided to self-host my code repositories with gitea,

Had to install the latest version of node and go then build the project,

sudo apt install nodejs npm 
npm install -g n
n lts
wget https://go.dev/dl/go1.21.5.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.21.5.linux-amd64.tar.gz

Lets make a user just for gitea:

sudo adduser gitea
su - gitea
echo "export PATH=$PATH:/usr/local/go/bin" >> ~/.bashrc
. ~/.bashrc

Lets pull gitea, build and launch:

git clone https://github.com/go-gitea/gitea
cd gitea
TAGS="bindata sqlite sqlite_unlock_notify" make build
./gitea web

You can make a MySQL/Postgres user, but it was timing out too freqently:

CREATE DATABASE 'gitea';
CREATE USER 'gitea'@'localhost' IDENTIFIED BY 'secret';
USE gitea;
GRANT ALL ON gitea.* TO 'gitea'@'localhost';

Had success with SQLite though. And be warned, had to use a 2GB droplet in order to make the project. Referral link.

--

--