Reputation: 1492
I have pre-push hook implemented with Husky. Now I wanna remove it.
Problem is that after yarn remove husky
git hooks are still there inside .git/hooks
.
Because of that I get this error every time I want to commit or switch branch or commit, thus commiting is not even possible -->
.git/hooks/pre-commit: line 6: node_modules/run-node/run-node: No such file or directory
I know I can always delete every hook inside .git/hooks
but how I can push this changes remotely? How not to force my teammates do the same thing?
Also I know I can commit using -n
flag but still I would like not to do it.
Upvotes: 67
Views: 58645
Reputation: 609
The Husky documentation recommends doing it this way:
npm uninstall husky && git config --unset core.hooksPath
or
yarn remove husky && git config --unset core.hooksPath
Upvotes: 18
Reputation: 1492
So basically removing remote git hooks is not possible.
The best you can do is to remove your local ones and notify the rest of the team to do the same.
On how to remove git hook locally check @wotanii answer.
Upvotes: 2
Reputation: 2826
Assuming you have no non-husky hooks, you might want to keep:
rm -f .git/hooks/*
every file inside ".git/hooks/" is either a git-hook or ignored by git. By removing everything inside, you'll get rid of all hooks, and restore the default behavior.
By default there are example-hooks in there, but except for being examples they serve no purpose, so you can delete them.
Upvotes: 96
Reputation: 982
I think it's better to keep all *.sample in .git/hooks
To remove git hooks who come husky :
cd .git/hooks
ls | grep \.sample -v | xargs rm
Upvotes: 27