How to Self-Host your own git repository

You can self-host your own git repository, thus avoiding services like github, gitlab, bitbucket. This gives you full control over the repositories. Make as many as you want and make them private or public as you please. Serve it under you own domain. Allow and use whatever licenses you prefer.


Gitea, which describes itself as a painless self-hosted Git service, is written in the go language (utilising the hugo generator) and is therefore highly efficient and super fast.

Installation and update instructions

cd into the project folder. If you're updating remove the outdated gitea executable with rm gitea. Look here for the latest version of gitea.

wget -O gitea

chmod +x gitea

Then run ./gitea web, go through the installation process and modify your webserver.

# Apache VHOST
<VirtualHost *:443>
  SSLEngine On
  SSLCertificateFile /path/to/cert.crt
  SSLCertificateKeyFile /path/to/cert.key
  ProxyPreserveHost On
  ProxyRequests off
  ProxyPass /
  ProxyPassReverse /

Et voilà.

Run as a service

Check this out and choose your desired service. In the case below systemd is being used.

Description=Gitea (Git with a cup of tea)

ExecStart=/home/git/gitea/gitea web
Environment=USER=git HOME=/home/git


When using systemd save and modify this file under /etc/systemd/system and run the following.

systemctl enable gitea
systemctl start gitea