Cgit

Published 01-01-0001 00:00:00

Installing Cgit on Gentoo or Calculate

Unmasking the latest version

  • For Gentoo Linux
echo "=www-apps/cgit-1.1 ~amd64" >> /etc/portage/package.accept_keywords
  • For Calculate Linux
echo "=www-apps/cgit-1.1 ~amd64" >> /etc/portage/package.keywords/custom

Adding a USE-flag

  • For Gentoo Linux
echo "www-apps/cgit vhosts" >> /etc/portage/package.use
  • For Calculate Linux
echo "www-apps/cgit vhosts" >> /etc/portage/package.use/custom

Installing the latest version

emerge -av www-apps/cgit

Setup a cgit by webapp-config

webapp-config -h git.kronoz.guru -d cgit -I cgit 1.1

Installing the packages for filters

emerge -av dev-python/markdown dev-python/docutils

Configuring the application configuration file: /etc/cgitrc

virtual-root=/
cache-root=/var/www/git.kronoz.guru/cache
robots=noindex, nofollow
clone-prefix=git://git.kronoz.guru https://git.kronoz.guru

enable-index-links=1
enable-commit-graph=1
enable-log-filecount=1
enable-log-linecount=1

root-title=KronoZ's git repositories
root-desc=Source code of various KronoZ's projects
source-filter=/usr/lib/cgit/filters/syntax-highlighting.py
about-filter=/usr/lib/cgit/filters/about-formatting.sh
readme=:README.md

snapshots=tar.gz tar.bz2 zip
mimetype-file=/etc/mime.types

enable-git-config=1
remove-suffix=1
scan-path=/home/kronoz/git/repositories/public/

section=Repositories                                         

repo.url=gentoo-overlay                                      
repo.path=/home/kronoz/git/repositories/public/gentoo-overlay/.git                                                        
repo.desc=Gentoo overlay || mirror https://gitlab.com/KronoZ/gentoo-overlay                                               
repo.owner=KronoZ                                            
repo.readme=/home/kronoz/git/repositories/public/gentoo-overlay/README.md

Configuring the web-server configuration file

  • Caddy: /etc/caddy/vhosts/sites-available/git.kronoz.guru
git.kronoz.guru {

  root /var/www/git.kronoz.guru/htdocs/cgit
  tls root@kronoz.guru

  cgi {
     match /cgit
     exec /var/www/git.kronoz.guru/cgi-bin/cgit.cgi
     env CGIT_CONFIG=/etc/cgitrc
  }

  rewrite {
     if {path} is /
     to /cgit/{uri}
  }

  rewrite {
     to {path} /cgit/{uri}
  }

  log /home/kronoz/web/data/logs/caddy-access_git.kronoz.guru.log {
      rotate_size 100 # Rotate after 100 MB
      rotate_age  14  # Keep log files for 14 days
      rotate_keep 10  # Keep at most 10 log files            
  }

  errors /home/kronoz/web/data/logs/caddy-error_git.kronoz.guru.log {
        rotate_size 50 # Rotate after 50 MB                  
        rotate_age  30 # Keep rotated files for 30 days      
        rotate_keep 5  # Keep at most 5 log files            
  }

}