If husky hook is not running, we need to execute command chmod +x .husky/*
. But I need to run chmod +x .husky/*
every time I go to a new branch. Otherwise, it shows this error:
hint: The '.husky/pre-commit' hook was ignored because it's not set as executable.
Can anybody tell me how can I solve this issue?
I am using husky 7.0.1
I got my solution. I added pre-commit
file manually so it was not executable(644). I removed pre-commit file and added using this command yarn husky add .husky/pre-commit
that makes pre-commit
file executable(755) and works fine any new branch.
So, to solve this type of issue, we have to avoid adding manual hook file and use this command yarn husky add .husky/<hookname>
to add.