tlwiki-wikijs/misc/archive/thurstylark-vps/cgit.md

80 lines
1.8 KiB
Markdown
Raw Permalink Normal View History

---
title: "Cgit"
description: "And automatic config deployment on git push"
author: "Thurstylark"
date: 2021-9-25
draft: false
---
Current configuration can always be found at https://git.thurstylark.com/cgit.git/tree
### Push To Deploy
The remote repo is set up to deploy the entire contents of the repo to `/srv/cgit` by using the `post-receive` hook in the git repo.
```
#!/bin/bash
GIT_WORK_TREE=/srv/cgit git checkout -f
```
This allows configuration changes to be edited on a local repo, committed, then pushed to the remote to apply changes.
### About Page
Had a problem with the about page not showing when the appropriate file names are definied as readme files. Here was the problematic config:
```Cprettyprint linenums
#css=/cgit-css/cgit.css
#logo=/cgit-css/cgit.png
root-title=Thurstylark
root-desc=Projects and Dotfiles
source-filter=/srv/cgit/syntax-highlighting.py
about-filter=/usr/lib/cgit/filters/about-formatting.sh
enable-git-config=1
scan-path=/srv/git
enable-http-clone=1
clone-url=https://git.thurstylark.com/$CGIT_REPO_URL
#
# Search for these files in the root of the default branch of repositories
# for coming up with the about page:
#
readme=:README.md
readme=:readme.md
readme=:README.mkd
readme=:readme.mkd
readme=:README.rst
readme=:readme.rst
readme=:README.html
readme=:readme.html
readme=:README.htm
readme=:readme.htm
readme=:README.txt
readme=:readme.txt
readme=:README
readme=:readme
readme=:INSTALL.md
readme=:install.md
readme=:INSTALL.mkd
readme=:install.mkd
readme=:INSTALL.rst
readme=:install.rst
readme=:INSTALL.html
readme=:install.html
readme=:INSTALL.htm
readme=:install.htm
readme=:INSTALL.txt
readme=:install.txt
readme=:INSTALL
readme=:install
```
The solution was to move the `scan-path` directive to the end of my cgitrc. See the [cgitrc manpage](https://git.zx2c4.com/cgit/tree/cgitrc.5.txt#n392) for details.