mfashby.net

Website mfashby.net
git clone git://code.mfashby.net:/mfashby.net
Log | Files | Refs | Submodules | README

commit ac00b9e1359f32d50184f9e73c7568fcc5101d1c
parent d4233c715c5d69e395939d57d2f3f35e794e5657
Author: Martin Ashby <martin@ashbysoft.com>
Date:   Sun,  1 Jan 2023 00:46:02 +0000

post on cgit

Diffstat:
Acontent/posts/2022-12-31-cgit.md | 24++++++++++++++++++++++++
1 file changed, 24 insertions(+), 0 deletions(-)

diff --git a/content/posts/2022-12-31-cgit.md b/content/posts/2022-12-31-cgit.md @@ -0,0 +1,23 @@ +--- +title: "Cgit" +date: 2022-12-31T23:39:38Z +draft: false +--- + +In a [previous post](posts/2022-09-25-back-to-git/) I switched back from fossil to git. I found [gitea](https://gitea.io/) to be a pretty good server. However, it has many features I do not use, and it takes a minimum of 15% of the RAM on my Raspberry Pi home server! I found a simpler setup. + +I have switched to plain git server accessed with SSH, which [git-scm](https://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server) documents how to set up. I'd still like a web UI to allow others to see and download my code. [Cgit](https://wiki.archlinux.org/title/Cgit) is a simple web user interface for multiple git repositories. It runs as a CGI application, and I use caddy web server, so thanks to [Luke Hsiao's blog post](https://luke.hsiao.dev/blog/cgit-caddy-gitolite/) and [Andras Schneider's Caddy CGI plugin](https://github.com/aksdb/caddy-cgi) I managed to get it running fairly easily. + +One hitch was adding git LFS support. I use git LFS for some media files on my blog. Gitea includes git LFS support out of the box, but a plain git server does not. I am using the standalone [reference server](https://github.com/git-lfs/lfs-test-server). This has a disclaimer that it's not 'production ready', but since I'm running this behind tailscale I'm reasonably happy it's ok. + +A second hitch was figuring out how to redirect from old repo locations to new ones, so I don't have to update every link in my blog. New repo locations simply don't have the `/martin` prefix. This seemed difficult in caddy, until I found [this post](https://caddy.community/t/modify-uri-and-then-redirect/16686/4) and I wound up with the following configuration, which seems to work well: +``` + ... + handle /martin* { + route { + uri strip_prefix /martin + redir https://{host}{uri} + } + } + ... +``` +\ No newline at end of file