KaliLinux 2018.2: 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/sh -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 apt install -y apache2 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 a2enconf cgit sudo systemctl enable apache2 sudo systemctl restart apache2}create_repo(){ sudo apt install -y git mkdir -p “${SCAN_PATH}”/test.git cd “${SCAN_PATH}”/test.git git init –bare}cgit_main(){ cgit_install apache_install create_repo}cgit_main

2 Create repository

Create repository in scan-path directory.

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

3 Access to cgit

Access to the following URL.

https://<server>/cgit

Created repository is displayed.

0001_cgit.png

Android | Linux | SDL - Narrow Escape