Vue Git提交代码报错,Commit failed with error

前言

最近Vue项目提交代码报“Commit failed with error”,确认代码无问题
Vue Git提交代码报错,Commit failed with error_第1张图片

错误提示

一、git提交失败

git:>running pre-commit hook:lint-staged
Vue Git提交代码报错,Commit failed with error_第2张图片

二、错误分析

这句话的意思,大概是有一个钩子,提交前检查项目代码的规范,eslint的检查。提交失败的原因:项目中error过多,导致检测未通过,提交失败。

解决思路

一、不进行检查

那就是删除掉pre-commit hook,具体在项目文件夹.git\hooks目录下,找到文件pre-commit
在这里插入图片描述

二、再次提交成功

小结

这个方法比较简单粗暴,自然也是存在一些弊端,代码不严谨,不能符合Eslint标准。也有其他的解决方式,在配置文件中,不需要使用eslint时,把lintOnSave设为false即可。

转载(冯浩月):https://blog.csdn.net/m18633778874/article/details/87448059

你可能感兴趣的:(Commit,failed,with,error,git,vue,bug)