husky: Does not work with Github Desktop on Windows
Troubleshoot
- Before creating an issue, please check: https://typicode.github.io/husky/#/?id=troubleshoot
If you’re migrating from husky 4, see: https://typicode.github.io/husky/#/?id=migrate-from-v4-to-v7
Context Please describe your issue and provide some context:
I’ve this pre-commit hook:
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npm test
It works with git command line and Tortoise Git on Windows as expected, but on Github Desktop 3.0.2 I’ve this error message when I commit:
An address incompatible with the requested protocol was used.
husky - pre-commit hook exited with code 1 (error)
A hook file like this works:
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
echo hello
But anything with npm
does not.
Please kindly check it out.
Thank you!
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 3
- Comments: 17 (4 by maintainers)
Steps to reproduce:
In an empty folder:
git init
package.json
npm install
npx husky add .husky/pre-commit "npm test"
Adding “C:\Program Files\Git\bin” to my PATH environment variable fixed this error at one point, as I described on Stackoverflow. Maybe try that?
A combination of this and this https://github.com/desktop/desktop/issues/12586#issuecomment-1223600474 works for me
I used windows with nvm.
I tied to change
.husky\pre-commit
toIt works as expected.
However I can’t change the script like this because it won’t work for Mac or Linux users.
I think it would be a bug of Github Desktop, I’ll fire bug report later