tech.howto.git.hooks

Thu Sep 10 02:03:33 PM EDT 2026

upload to neocities on git push automatically.

neocities has a page [1] that shows how to put a script in .git that gets run when you push. it says ‘pre-push’ so maybe that should be a post push.

TODO git pre-push vs post-push hooks

anyway i made it run my Makefile so itll generate the html for markdown files as needed and then upload then mostly as needed individually. all i have to do is git push and there it is. nice.

and heres the script

.git/hooks/pre-push

#!/bin/sh
#neocities push .
make 

i made a git pre-commit hook to automatically update a stats file so i can see the number of visitors reported by neocities over time (and possibly graph it later). see the makefile example for how i’m reading the stat history. update: i disabled this because it keeps leaving the stats file out of the commit. theres probably a better hook to put this in like pre-add idk.

.git/hooks/pre-commit

#!/bin/bash
# vague
# Fri Sep 11 12:33:59 PM EDT 2026
# track site stats in git repo history. 
# surely i can come up with a git command to show changes over time
/usr/local/bin/neocities info
/usr/local/bin/neocities info > stats

references

1 https://neocities.org/cli

see also

makefile