How to deploy Gitea
Why Gitea and why need Gitea?
Because gitea is light weight which can run on my VPS easily.
As we all know that github can not be visited all the time in China mainland, so it is neccessary to build our own git service.
How to install?
Download from official webpage and rename the binary file as gitea and make it executable. Remember that you should choose appropriate version to download.
1
2
3
4wget https://dl.gitea.com/gitea/1.20.4/gitea-1.20.4-linux-amd64
mv gitea-1.20.4-linux-amd64 gitea
chmod +x gitea
cp gitea /usr/local/bin/giteaDownload git
1
2apt update
apt install gitCreat a user naming git for gitea
1
2
3
4
5
6
7
8adduser \
--system \
--shell /bin/bash \
--gecos 'Git Version Control' \
--group \
--disabled-password \
--home /home/git \
gitCreate required directory structure
1
2
3
4
5
6mkdir -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/giteaAdding bash/zsh autocompletion (from 1.19)
copy the content of bash_autocompletion into /usr/share/bash-completion/completions/giteaPreparation of database
1 | su -c "psql" - postgres |
1 | local giteadb gitea scram-sha-256 |
using psql -U gitea -d giteadb
to test the connection.
create a new service and paste the content of template
1
vim /etc/systemd/system/gitea.service
Enable and start Gitea at boot:
1
2sudo systemctl enable gitea
sudo systemctl start giteaNow go to your_ip:3000 to config the installation.
How to disable register?
1 | vim /etc/gitea/app.ini |
Find and change as follows
1 | DISABLE_REGISTRATION = true |
How to set the mail server?
If you are using iRedmail as me
1 | [mailer] |
Where is my Gitea?
Gitea is running on 3000 port.