I'm basing my own deployment of hugo on my server on [[https://jasonmurray.org/posts/2020/githugogen/][this article]] by Jason Murray. I don't have much to change here, and his way of deploying makes a lot of sense to me.
I'm breaking it up here with a lot of his comments, simply so I don't get lost when reviewing this in a few years/ months.
#+begin_src sh :tangle .git/hooks/post-receive
#!/bin/bash
# Directory on the server where the website will be mapped.
export GIT_WORK_TREE=/srv/bajsicki.com
echo `pwd`
echo "post-receive: Generating https://bajsicki.com with Hugo..."
# Create the directory and all subdirectories if they don't exist.
mkdir -p $GIT_WORK_TREE
chmod 755 $GIT_WORK_TREE
# Check out the contents of the repository and extract the files to $GIT_WORK_TREE
git checkout -f main
# Remove any files already in the public directory, a fresh copy will be generated by hugo