CGit GitHub-Theme

Modern GitHub-inspired theming for the CGit repository browser, featuring icons and dark mode. A dockerfile can bundle a full apache-based installation.

CGit is a simple and lightweight web-based git repository browser. Despite dating back to 2006, it is still a viable and capable solution, but comes with a correspondingly (arguably) “dated” interface. However, including a single stylesheet allows to override the theme for a more contemporary look and feel.

Using the custom stylesheet file aims towards providing the following features:

For installation, the theme CSS can be referenced by a corresponding HTML tag as configured by head-include. Note that the below example loads scripts and styles for local syntax highlighting, too. Otherwise, no additional assets are needed, due to directly embedded SVG icons.

CGit Apache Docker

The provided Dockerfile can be used for a minimal apache-based CGI setup. The main repository index should be mounted at /mnt/, and can be kept read-only – just as the image. A tmpfs provides scratch space for cgit’s local cache.

docker build --pull -t cgit:local .
docker run --rm \
    --read-only -v /media/mnt/vcs/git:/mnt:ro --tmpfs /tmp:size=10%,mode=1777,rw,noatime,noexec,nosuid,nodev \
    --user $(id -u www-data):$(getent group git | cut -d: -f3) --security-opt=no-new-privileges:true --cap-drop=all \
    --network=host -e APACHE_PORT=8080 --name cgit cgit:local

Running as root is not needed, the container can be started with any host user or group that has read access to the mounted repositories. The APACHE_PORT environment variable allows to override the port to listen on.

The mounted repository root directory can optionally provide a cgitrc to be included from the main configuration, for example for referring to a custom about page.

root-readme=/mnt/README.md

Similarly, an apache.conf can be added, for example for referring to a .htpasswd based authentication.

<Directory "/usr/lib/cgit/">
    AuthType Basic
    AuthName "Git Repository Browser"
    AuthUserFile /mnt/.htpasswd
    Require valid-user
</Directory>

Code & Download