Because of its simplicity, we use remote repository placed on shared disk, accessing it using file system path (\server\share). Is is possible, in such case, to run hook scripts defined in remote repository? I have defined one but it seems like it is not launched (tested using non valid edit in hook script, witch should cause an error).
By default hooks are stored in . git/hooks outside of the working tree and are thus not shared between users of the repository. The hooks can be included in a directory within the repository and then each developer can set Git up to use them.
By default the hooks directory is $GIT_DIR/hooks , but that can be changed via the core. hooksPath configuration variable (see git-config[1]). Before Git invokes a hook, it changes its working directory to either $GIT_DIR in a bare repository or the root of the working tree in a non-bare repository.
Git hook is a script you can run before (pre-commit) or after (post-commit) a commit is made. There can be more than one of such a script.
They are placed in a specified folder. Any git repository has a .git/hooks
folder with file(s) containing hook scripts.
You need to answer Do you have the event you are testing bind to a hook present in your's git repository?
Check also this on how git executes hooks in Windows:
Tips for using hooks:
Some more git hooks reading:
My advice after few hours of fight, double check value:
git config core.hookspath
It should be empty or point your hooks folder (.git\hooks
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With