This article will describe installing cgit.
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}/repo cgit_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 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.
$ mkdir -p "${SCAN_PATH}"/test.git $ cd "${SCAN_PATH}"/test.git $ git init --bare