今天在执行 git commit 命令时报错:pre-commit hook failed (add --no-verify to bypass)

问题原因:
pre-commit 钩子惹的祸,在终端输入 git commit -m "www.w3h5.com" 提交代码时,pre-commit (客户端)钩子会在 Git 键入提交信息前运行代码检查。如果代码不符合相应规则,则报错。
解决方式:
1、 简单粗暴的方式
找到项目的 .git 文件夹下面的 hooks 文件夹,手动删除 pre-commit 文件。
运行命令:rm -rf ./git/hooks/pre-commit 删除 pre-commit 文件
2、根据提示在命令中添加 --no-verify
将 git commit -m "www.w3h5.com" 改为 git commit --no-verify –m "www.w3h5.com"
3、代码改到符合标准再提交(推荐)
未经允许不得转载:w3h5 » git commit报错:pre-commit hook failed的解决方法
原创文章,作者:306829225,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/228493.html