How to remove remote git hooks?


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.


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.

Answered By – wotanii

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published