question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

hook was ignored because it's not set as executable

See original GitHub issue

Context 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:open
  • Created a year ago
  • Reactions:1
  • Comments:11

github_iconTop GitHub Comments

33reactions
parkgangcommented, Aug 12, 2022

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.

chmod ug+x .husky/*

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.

14reactions
yury-tkcommented, Aug 17, 2022

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).

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found