Search code examples
gitcygwingithooksgitkraken

Git hook within Gitkraken ignores exit code


I try to set up a first simple pre-commit hook on a project on windows but I don't manage to stop the commit using exit code. I use Gitkraken and it runs cygwin as shell.
The pre-commit file contains the following script:

#!/bin/sh
echo "OK THAT line works..." > test.log
exit 1

When commiting, it generates the log file but the commit is not blocked by the return code.
What am I doing wrong?


Solution

  • Finally found by myself with a colleague. In case someone run into the problem. The Path to sh parameter for Gitkraken has to be set to cygwin but with the -i option:
    C:\cygwin64\bin\mintty.exe -i

    edit: or simpler with c:\cygwin64\bin\sh.exe