summaryrefslogtreecommitdiff
path: root/common/microlog
diff options
context:
space:
mode:
Diffstat (limited to 'common/microlog')
-rw-r--r--common/microlog/2026-09-08.gmi23
1 files changed, 23 insertions, 0 deletions
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 <user>@<http_machine> 'git -C <dir> pull; make -C <dir>/gemini'
+ git -C <dir> pull
+ make -C <dir>/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