cgit is a web view for git repositories that is widely used and quite simple to install. This is just a brief overview over installation of cgit with Nginx on a Debian system, because I had to make a few adjustments.

First of all, of course you have to install cgit and (if not previously installed) nginx. Since cgit only provides a CGI interface, you also need to install fcgiwrap to connect Nginx to cgit. Both fcgiwrap and Nginx have to be started as services:

systemctl start nginx fcgiwrap
systemctl enable nginx fcgiwrap

On Debian, cgit web resources are stored in /usr/share/cgit and the cgit CGI script is stored in /usr/lib/cgit. This means that the Nginx document root will point to /usr/share/cgit so that the web server can deliver static resources from there, but the CGI script filename has to point to /usr/lib/cgit/cgit.cgi.

On my first attempt cgit messed up links within repositories (it duplicated the repository name in the URL). Thus, I also had to specify the virtual-root in the configuration file. According to the documentation however, this setting should not be needed if PATH_INFO is set correctly. According to a blog post the problem might be that some versions of fcgiwrap overwrite PATH_INFO. Overall, the following cgit configuration file worked for my setup:

# /etc/cgitrc

# Paths to the static resources in /usr/share/cgit (=Nginx root)

# Folder containing all my repositories

# root for all cgit links

Nginx has to forward the requests to fcgiwrap which will then call the CGI script from cgit. For this, you have to setup fcgiwrap in Nginx as a FastCGI endpoint:

# /etc/nginx/sites-available/cgit.conf

server {
    listen [::]:80;
    listen 80;

    # Path to the static web resources of cgit
    root /usr/share/cgit;

    try_files $uri @cgit;

    location @cgit {
        include             fastcgi_params;

        # Path to the CGI script that comes with cgit
        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;

        # Path to the socket file that is created/used by fcgiwrap
        fastcgi_pass        unix:/run/fcgiwrap.socket;
    # Used by me: Only allow this web page to be accessed on intranet,
    # even though nginx listens globally
    deny all;

Now you can reload nginx with systemctl reload nginx and view your git repositories on

Enabling Markdown

cgit includes the possibility to display an about page from a README file, e.g. a markdown formatted To enable this, you have to adjust the file cgitrc and set the following two options:

about-filter=/usr/lib/cgit/filters/ is a helper script that calls the right formatter depending on the file extension, e.g. markdown for .md. In order for the script to work you need to have the Python package markdown installed. On Debian you can install this package with the python3-markdown.

I do not maintain a comments section. If you have any questions or comments regarding my posts, please do not hesitate to send me an e-mail to