Debian 9: Install cgit for Git web frontend

Table of Contents

1 Install cgit

Install cgit package.

  • This article uses default SSL/TLS certicication file for https. Please change your SSL/TLS certification file.
  • If you use http instead of https, change 443 to 80 and delete SSLXXX directive in /etc/apache2/conf-available/cgit.conf.
  • SCAN_PATH is used to scan-path in /etc/cgitrc.

#!/bin/shset -e[ -z “${SCAN_PATH}” ] && SCAN_PATH=${HOME}/repocgit_install(){ sudo apt install -y cgit echo “scan-path=${SCAN_PATH}” | sudo tee -a /etc/cgitrc}apache_install(){ sudo cp /etc/apache2/conf-available/cgit.conf /etc/apache2/conf-available/cgit.conf.orig cat <<EOF | sudo tee /etc/apache2/conf-available/cgit.conf<VirtualHost _default_:443> SSLEngine on SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key$(sed -e ‘s/^/ /g’ /etc/apache2/conf-available/cgit.conf.orig)</VirtualHost>EOF sudo a2enmod cgid sudo a2enmod ssl sudo systemctl restart apache2}cgit_main(){ cgit_install apache_install}cgit_main

2 Create repository

Create repository in scan-path directory.

$ mkdir -p “${SCAN_PATH}”/test.git$ cd “${SCAN_PATH}”/test.git$ git init –bare

3 Access to cgit

Access to the following URL.


Created repository is displayed.


Android | Linux | SDL - Narrow Escape