How to properly use post-receive hook?
问题 My directory structure is: ~/parent.git/.git/hooks/post-receive The post-receive hook looks like: #!/bin/sh git checkout -f When I push into parent.git, the script does not run. I can't figure out the problem, as every bit of the internet says this should work. I chmod'd post-receive, so I know that is not the problem. Any help is much appreciated. 回答1: As Chris mentioned you seem to have the same problem as reset hard on git push Specifically hooks run with CWD and GIT_DIR set to the .git