Put the post-commit file under .git/hooks/ of your project, and make sure it is well-formatted (LF) and it has the correct permissions.
If you want to automate its creation from a Makefile, use the following rule:
.PHONY: help configure-git configure
# [...]
help:
# [...]
@echo " configure - Configure the project folder."
@echo " configure-git - Configure the project folder for git usage. Use 'configure' for global configuration of the project."
# [...]
.git/hooks/post-commit:
@if command -v "dos2unix" > /dev/null 2>&1; then \
curl -fsSL "https://gist.githubusercontent.com/Cynnexis/b79ea3a883073711b342273b646acf3c/raw/post-commit" -o ".git/hooks/post-commit"; \
dos2unix ".git/hooks/post-commit"; \
else \
touch ".git/hooks/post-commit"; \
fi
configure-git: .git/hooks/post-commit
configure: configure-git
# [...]