Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

husky > pre-commit hook failed (add --no-verify to bypass)

Suddenly I am getting the "husky > pre-commit hook failed (add --no-verify to bypass)" error message when I give the git commit.

enter image description here

I don't know what I am doing wrong. I tried git clean command too. Anyone faced similar issue?

like image 740
Sathia Avatar asked Sep 17 '20 17:09

Sathia


2 Answers

Husky can prevent you from bad git commit, git push and more. If you are getting this error check your code syntax. In case you are getting this error even if your code is valid, please use the below solution.

#Solution 1:

Delete the .git/hooks folder and then do the npm install for reinstall husky. There are chances for conflicts with husky-generated files and .git/hooks/ files.

#Solution 2:

this is a temporary/quick solution.

git commit -m "message" --no-verify
like image 63
Sathia Avatar answered Dec 06 '22 23:12

Sathia


The Comment by @Elio is a much preferred solution, as --no-verify is skipping whatever scripts that should run.

I assume here that if the scripts are there it is for a reason...

Therefore:

You can also delete the .git/hook folder and then uninstall and reinstall husky. There are some conflicts with husky generated files and .git/hook/ files. That worked for me

In my case, the uninstall/re-install was not necessary.

like image 33
manandearth Avatar answered Dec 07 '22 00:12

manandearth