cgit

cgit

My cgit server: https://git.vkdbois.xyz

Why cgit

The reason is simple: I’m lazy.

Plus I don’t need issues or pull requests or collaboration or forge stuff (idk if it landed) or login or auth or multiple accounts or any of that stuff Gitea provides. I’m sure Gitea/Forgejo is good, but I just don’t need it.

Setting up git

To set up a git server, you have to have a user named git and do some stuff. I followed the instructions over at https://landchad.net/git/.

Setting up cgit

Followed this article since I’m using Caddy.

Systemd service for cgit + fcgiwrap:

# systemctl edit --full --force cgit.service
[Unit]
Description=CGI web interface to the Git SCM
After=network.target

[Service]
Type=exec
ExecStart=fcgiwrap -f -p "/usr/lib/cgit/cgit.cgi" -s tcp:127.0.0.1:8999

[Install]
WantedBy=multi-user.target

Caddyfile configuration for cgit:

git.vkdbois.xyz {
        handle_path /cgit-css/* {
                root * /usr/share/cgit/
                file_server
        }

        handle {
                reverse_proxy localhost:8999 {
                        transport fastcgi {
                                env DOCUMENT_ROOT /usr/lib/cgit/
                                env SCRIPT_FILENAME /usr/lib/cgit/cgit.cgi
                        }
                }
        }
}

/etc/cgitrc

I use the default cgitrc, except for a few changes:

/etc/cgitrc
css=/cgit-css/cgit.css
logo=/cgit-css/vkdbois.png
virtual-root=/
clone-prefix=https://git.vkdbois.xyz

root-title=git.vkdbois.xyz
root-desc=Powered by cgit.

scan-path=/var/git/

Theme modification

As you can see from the screenshot above, I modified cgit’s CSS a bit.

I was initially introduced to this idea from a blog I stumbled across: https://vidhukant.com/blog/cgit-catppuccin/. This is his cgit server: https://git.vidhukant.com. Thanks vidhukant!

Here’s my cgit server theme: https://git.vkdbois.xyz/cgit-dark-theme/ (or https://codeberg.org/theophinetheodore/cgit-dark-theme/).

Tips

  • If the git user has a different $HOME (say /var/git), you can mention that directory in /etc/cgitrc for cgit to scan with the scan-path= key.

Eg.

/etc/cgitrc
scan-path=/var/git
  • By default, cgit shows git as the repo owner name, but you could set it to your name by:
sudo usermod -c "Your Name" git
  • By default, the descriptions of the repos show up as something like “set description” or something. To change it, navigate to the bare repository in your server and edit the description file.