I tried to run this command but it always shows this error. Help me, please!
$ pre-commit install
[ERROR] Cowardly refusing to install hooks with `core.hooksPath` set.
hint: `git config --unset-all core.hooksPath`
Run:
git config --unset-all core.hooksPath
If the global core.hooksPath is not empty, run:
git config --global --unset-all core.hooksPath
But of course, it's global so be careful.
Why pre-commit is nonfunctional with global hooks? see issue
You are getting the above error because of setting up a global hook path.
It can be resolved in below two ways: -
Unset the global hook path as below: -
git config --unset core.hooksPath
Set local hooks path as below: -
git config --local core.hooksPath .git/hooks
There is a very interesting conversation on this topic, I will highly recommend going through it once:-
issue Cowardly refusing to install hooks with core.hooksPath set
Please let me know in the comments if this resolves your problem. I am super curious about it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With