blob: 7ef1b45f8484259252c186b0486aed405f46bca9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
|