hook was ignored because it's not set as executable
See original GitHub issueContext I get following error on Mac/Linux machines:
hint: The '.husky/pre-commit' hook was ignored because it's not set as executable.
hint: You can disable this warning with git config advice.ignoredHook false.
STR I added husky 7 on Windows according to the recommendations. Then I committed all changes to git and updated on other machine (Mac/Linux). I ran yarn update, which caused “prepare” script to run (husky install). then I tried to change something and commit, which showed me above errors and didn’t execute hooks.
Expected behavior: Husky should somehow prepare all related files to automatically work on any platform without additional manual steps, like chmod
Thank you!
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:11
Top Results From Across the Web
Why is my Git pre-commit hook not executable by default?
hint: The 'pre-commit' hook was ignored because it's not set as executable. hint: You can disable this warning with `git config advice.
Read more >githooks Documentation - Git
Hooks that don't have the executable bit set are ignored. By default the hooks directory is $GIT_DIR/hooks , but that can be changed...
Read more >宋发元 - CSDN博客
hint: The '.git/hooks/pre-commit' hook was ignored because it's not set as executable. hint: You can disable this warning with `git config ...
Read more >Husky - Git hooks
Hooks not running · Ensure that you don't have a typo in your filename. For example, precommit or pre-commit.sh are invalid names. ·...
Read more >githooks(5) — Arch manual pages
Hooks that don't have the executable bit set are ignored. ... affect the outcome of git merge and is not executed, if the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I had that problem in WSL after init on Windows 11. This is a scenario similar to the issue you raised.
I also posted an answer on stackoverflow, but I was able to solve it with the command below. If you commit after reflecting once, the problem does not occur continuously.
I think it’s probably a problem that wasn’t created taking into account the file permissions of Linux at the time of init on Windows.
chmod works, but it is not normal solution. It is trick. We all work under different OSs and tool should work correctly under each of them and tool setup should be portable among them by simple commit/checkout. The only acceptable one is some sort of automatic post-tune that automatically finds the error and fixes it (and maybe requests to commit changes).