Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Husky needs to make executable for every new branch

Tags:

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

like image 207
Arif Avatar asked Jul 13 '21 17:07

Arif


1 Answers

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.

like image 115
Arif Avatar answered Nov 15 '22 06:11

Arif