aboutsummaryrefslogtreecommitdiff
path: root/content/posts/2022-12-31-cgit.smd
diff options
context:
space:
mode:
Diffstat (limited to 'content/posts/2022-12-31-cgit.smd')
-rw-r--r--content/posts/2022-12-31-cgit.smd25
1 files changed, 25 insertions, 0 deletions
diff --git a/content/posts/2022-12-31-cgit.smd b/content/posts/2022-12-31-cgit.smd
new file mode 100644
index 0000000..b2895f8
--- /dev/null
+++ b/content/posts/2022-12-31-cgit.smd
@@ -0,0 +1,25 @@
+---
+.title = "Cgit",
+.author = "Martin Ashby",
+.date = @date("2022-12-31T23:39:38Z"),
+.layout = "single.shtml",
+.custom = {"comments": true},
+---
+
+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