From b12dd3b2c810a9131b0efecb61b3fa7e6d2c0941 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Tue, 8 Sep 2026 08:46:12 +0100 Subject: add microlog post 2026-09-08 --- common/microlog/2026-09-08.gmi | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 common/microlog/2026-09-08.gmi (limited to 'common') diff --git a/common/microlog/2026-09-08.gmi b/common/microlog/2026-09-08.gmi new file mode 100644 index 0000000..7ef1b45 --- /dev/null +++ b/common/microlog/2026-09-08.gmi @@ -0,0 +1,23 @@ +I've just got a git hook working, so that my website updates itself after a push to main. + +To do this, you need a script in your remote repository called `hooks/post-update`. Given that I'm hosting my gemini:// capsule on the same machine, but the https:// website on another one on the same network, my script looks a little like this: + +``` +#!/bin/sh + +log=~nginx/logs/joeac.net.git-post-update.log +echo "pushing changes to https://joeac.net and gemini://joeac.net" +( + ssh @ 'git -C pull; make -C /gemini' + git -C pull + make -C /gemini +) 2>> $log 1>&2 +``` + +A few tricks: + +* don't forget to `chmod +x` the script +* the user that will run this hook script is the same as the user that hosts your git repository: in my case, that's the user `nginx` +* make sure `nginx` has a public key stored in the remote user's `~/.ssh/authorized_keys` file +* any output to stdout or stderr goes back to the git-pusher's CLI +* I've used a sub-shell and redirects to put logs in a logfile and not return them to the git-pusher -- cgit v1.2.3