pre-commit/hook: No such file or directory

Jitendra Vyas picture Jitendra Vyas · May 12, 2017 · Viewed 34.7k times · Source

I get this error when I try to commit.

OS - Latest OSX

Git version - git version 2.11.0 (Apple Git-81)

.git/hooks/pre-commit: line 2: ./node_modules/pre-commit/hook: No such file or directory

Answer

Mutant picture Mutant · Oct 11, 2017

pre-commit hook runs first when you try to commit changes, it can be used to do certain checks, tests, conditions. In this case, clearly, you don't have it, that's why it's complaining.

Go to .git/hooks directory and remove pre-commit file, as its trying to reference to node_modules/pre-commit/hook. It should resolve it.

Other option is append your commit with option: --no-verify, it will make the commit without checking.