Switching to gitolite+cgit from gitea
Sun Feb 2, 2020

Yesterday I switched my git server on this domain from running gitea to running gitolite with cgit as a web frontend. I didn't like gitea, and wanted something that was less github-ish and more just like a git server. I wanted a web interface to share things I'd like to make open-source but I wanted it to be read/clone-only. Gitolite and cgit fit the bill for this. I'm not going to explain how to set up gitolite and cgit but I will talk about some specific pitfalls I found while I was installing them on my debian 10 server that aren't mentioned in the documentation.

I installed gitolite following the guide on Gitolite's website. MAKE SURE THE KEY YOU USE HAS THE NAME YOU WANT TO USE FOR YOURSELF! I didn't do this first time and had to re-setup everything. I had to make some ~/.gitolite.rc changes to make everything work with cgit properly. (This isn't a full rc file, just the things I changed)

UMASK => 0027,
GIT_CONFIG_KEYS => 'gitweb.*'

also, GITEA LEAVES SOME HOOKS IN ALL REPOS. After transfering them to gitolite I had to remove all of the gitea hooks, which I did using find -name gitea -delete in the repositories directory.

I then installed cgit following the guide on the arch wiki, but had to make some changes. Here's my nginx configuration:

server {
	server_name git.itwont.work; # update to be your own domain
		root /usr/share/cgit;
	try_files $uri @cgit;

	location @cgit {
		include fastcgi_params;
		fastcgi_param SCRIPT_FILENAME /usr/lib/cgit/cgit.cgi;
		fastcgi_param PATH_INFO $uri;
		fastcgi_param QUERY_STRING $args;
		fastcgi_param HTTP_HOST $server_name;
		fastcgi_pass unix:/run/fcgiwrap.socket;
	}
}

and my cgitrc file:

root-title=itwont.work git
root-desc=Nihilazo's open-source projects

source-filter=/usr/lib/cgit/filters/syntax-highlighting.py

css=/cgit.css
logo=/cgit.png
robots=noindex, nofollow

remove-suffix=1

virtual-root=/

enable-git-config=1

readme=:README.md
readme=:readme.md
readme=:README
readme=:readme

about-filter=/usr/lib/cgit/filters/about-formatting.sh

project-list=/home/git/projects.list
scan-path=/home/git/repositories

The two lines to specifically note are the virtual-root line (which fixed URL issues I was having) and the enable-git-config line (which allowed me to configure repo properties within gitolite)

So yeah. Hopefully this might be useful for people with some config troubles.



photos · fun music · serious music · code · posts · notes · about · home