This site no longer uses 11ty or post-receive hooks, at the moment, I simply git push to the server after building the files.
I've been using git for years, but somehow never got into using hooks. In order to make updating this website smoother, I'm trying out a very simple hook script which executes on the server after I commit to it. After getting my local ssh configuration updated so that I didn't have to manually log in each time, the next step was figuring out how to commit directly into the server. This was done by adding a "remote" which is an SSH user@address with full path to the repo on the server.
With this additional remote, I now push into the main repo for storage and then to this new remote when I want to update the site.
On the server, the .git/hooks/post-receive script is waiting and will run:
Because I'm using 11ty, this triggers a rebuild of the static files. But this script could do whatever you need to build your site.
Although this is a very simple solution, it took me a lot of false starts and wrong ideas before I finally landed here.
Notes for future reference:
git config --global receive.denyCurrentBranch updateInsteadso you don't get an error committing into a non-bare repo.
git remote add deploy ssh://<your-name>@<your-ip>/path/to/your/repo
git push deploy branchNamewhen you want to update the site