How to remove git hooks

GitGithooks

Git Problem Overview


I had set up a git hook in pre-commit file to run git pull before any commit. Now I have deleted that file and restarted my computer multiple times, but that hook is still running before my commits.

How can I remove or disable that completely?

Git Solutions


Solution 1 - Git

I figured out what was causing that:
I had created my pre-commit hook in git core directory, but the git had created a pre-commit hook in project's .git/hooks/ directory. I just removed it.

It means running the command that @romin21 mentioned inside project's root directory:

rm -rf .git/hooks

Solution 2 - Git

Based on the documentation, git hooks should reside in $GIT_DIR/hooks/ - verify this dir does not contain the pre-commit hook file

If the problem persists, you could flag your git commit with --no-verify (that should bypass the pre-commit hook)

Information can be found at:

https://git-scm.com/docs/githooks

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAli FarhoudiView Question on Stackoverflow
Solution 1 - GitAli FarhoudiView Answer on Stackoverflow
Solution 2 - GitrogerView Answer on Stackoverflow