当前位置:   article > 正文

vue的git代码提交报错_vue3 git提交报错

vue3 git提交报错
22:13	Commit failed with error
			0 file committed, 8 files failed to commit: 修改移动端登陆token失效的问题1.1
			husky > pre-commit (node v16.15.0)
			Stashing changes... [started]
			Stashing changes... [skipped]
			→ No partially staged files found...
			Running linters... [started]
			Running tasks for src/**/*.{js,vue} [started]
			eslint --fix [started]
			eslint --fix [failed]
			→
			Running tasks for src/**/*.{js,vue} [failed]
			→
			Running linters... [failed]
			× eslint --fix found some errors. Please fix them and try committing again.
			C:\wangyanan\daan\project\86\pro\src\api\survey\login.js
			39:34  error  'token2' is not defined  no-undef
			55:34  error  'token2' is not defined  no-undef
			66:34  error  'token2' is not defined  no-undef
			✖ 3 problems (3 errors, 0 warnings)
			husky > pre-commit hook failed (add --no-verify to bypass)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21

解决办法

在使用命令 git commit -m ‘提交信息’ 将本地代码提交到远程仓库时候, 如果项目安装了 per-commit,则会在Git键入提交信息前进行代码风格检查,如果代码不符合相应规则,则报错。

解决方法有两种:

  1. 简单粗暴,删除掉pre-commit钩子
进入项目的.git文件夹(隐藏文件),根据路径 ./git/hooks/pre-commit 找到对应的pre-commit文件,直接删除。
  • 1
  1. 不按要求改的话, 提交的时候这样提交, 就可以绕过了eslint的检查了
git commit -m "提交页面备注" --no-verify
  • 1
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小丑西瓜9/article/detail/406762
推荐阅读
相关标签
  

闽ICP备14008679号