git commit报错 pre-commit 报错

报错信息

guchejia_web_app git:(5.1.1) ✗ git commit -am "[feat]: 修改弹窗"
Warning: Setting commit-msg script in package.json > scripts will be deprecated
Please move it to husky.hooks in package.json, a .huskyrc file, or a husky.config.js file
Or run ./node_modules/.bin/husky-upgrade for automatic update

See https://github.com/typicode/husky for usage

husky > commit-msg (node v8.9.0)
⧗   input: [feat]: 修改弹窗
✖   subject may not be empty [subject-empty]
✖   type may not be empty [type-empty]

✖   found 2 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

husky > commit-msg hook failed (add --no-verify to bypass)
➜  guchejia_web_app git:(uicheck) ✗ git status
On branch uicheck
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

 

原因

在终端输入git commit -am "**",提交代码

会触发pre-commit的钩子,他会在Git提交信息之前先做代码风格的检测

如果不符合相应规则,会报错

它的检测规则就是根据.git/hooks/pre-commit文件里面的相关定义

 

解决方案

提交代码commit时,忽略pre-commit校验的钩子,加上参数--no-verify

8 files changed, 5657 insertions(+), 5612 deletions(-)
2. 删除.git/hooks下的的pre-commit文件,重新commit
3. 卸载husky
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值