Post Commit Hook Not Running

后端 未结 4 1906
遥遥无期
遥遥无期 2020-12-24 10:43

My post commit hook is not running after git. I have verified that the hook does work if I just run it from the terminal. The code in the hook is:

#!/bin/s         


        
4条回答
  •  情书的邮戳
    2020-12-24 11:41

    My post-commit script wasn't being called because:

    I had named the script post-commit.sh, rather than just post-commit.

    To enable a hook script, put a file in the hooks subdirectory of your .git directory that is named appropriately (without any extension) and is executable. From that point forward, it should be called. We’ll cover most of the major hook filenames here. See git-scm

    Not sure why I had in my head that hooks needed the bash file extension.

    I also didn't realize hook scripts cannot have file extensions. For example,

    If you want to use the bundled hook scripts, you’ll have to rename them; their file names all end with .sample

    Hope this helps someone.

提交回复
热议问题