husky
husky copied to clipboard
gerrit commit-msg hook failed in v9
1、I work on window 10, my project code is mangaed by gerrit (for code review)
2、So I have two hook to work ①、pre-commit, for eslint check before commit ②、commit-msg, for add commit id to commit-msg before push to gerrit
it works well in husky v8
3、after upgrading to v9,I update pre-commit hook code from
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh
npx --no-install lint-staged -q
to
npx --no-install lint-staged -q
it works fine
4、but commit-msg hook alway failed, it output as following:
husky - commit-msg script failed (code 1)
5、this is my commit-msg hook code, how can i fix it (I rename the file name from 'commit-msg' to 'commit-msg.txt') commit-msg.txt
I have the same problem, after upgrading husky to v9, the commit-msg doesn't work.
try to call this git hook inside the husky commit-msg hook:
.husky/commit-msg
.git/hooks/commit-msg "$1"
it worked for me hope it works for you too.