在同步本地文件到线上仓库的时候

报错 pre -commit hook failed (add --no-verify to bypass)

当你在终端输入git commit -m "xxx",提交代码的时候,
pre-commit(客户端)钩子,它会在Git键入提交信息前运行做代码风格检查。
如果代码不符合相应规则,则报错。

虽然会提示add --no-verify,输入 git commit -m "xxx" --no-verify 绕过验证,强制提交。但是不一定能提交成功。

简单粗暴的解决方法:

暴力把pre-commit钩子删除掉。

具体步骤:
1.进入项目的.git文件夹(文件夹默认隐藏,可先设置显示或者命令ls查找)
2.再进入hooks文件夹
3.删除pre-commit文件
4.重新git commit -m "xxx" git push 即可

总结一句话: 删除.git的提交规则文件: rm -rf ./git/hooks/pre-commit

最后忠告: 这是不得已的办法。如果是日常开发,还是要写好代码的规范,现在代码一般都会进行ESLint校验,如果觉得麻烦的话,可以装一个Prettier插件,帮你格式化代码。

git commit -m "XX"报错 pre -commit hook failed (add --no-verify to bypass)问题的更多相关文章

  1. win10 git 报错 Host key verification failed

    从code.aliyun.com切回github 原先的known_hosts里记录的是code.aliyun.com的ip,必须新加一个github的. known_hosts报错Host key ...

  2. nginx: [emerg] unknown directive “ ” in /usr/local/nginx/nginx.conf.conf:xx报错处理

    当我们在修改Nginx的配置文件,然后加载配置文件./nginx -s reload   报错类似的错误, nginx: [emerg] unknown directive “ ” in /usr/l ...

  3. Git无法提交,报错

    Failed at the ant-design-pro@2.2.1 lint-staged script. npm ERR! This is probably not a problem with ...

  4. jenkins报错 Host key verification failed.

    一.Host key verification failed 问题描述 在本地windows机器上安装了jenkins,在git bash命令行窗口可以使用git pull命令,但是在jenkins ...

  5. python——报错ImportError:DLL load failed with error code -1073741795的解决方式

    python中导入一个包,import cv2总是报错'ImportError:DLL load failed with error code -1073741795',报错形式: 网上找了好久的解决 ...

  6. iOS报错:linker command failed with exit code 1 (use -v to see invocation) 问题解决方式之一

    百度库原版本:3.2.1  更新为:4.2.0,两个库相隔2年时间: 问题i: 更新CocoaPods的同时更新了百度地图库的版本,运行程序报错: linker command failed with ...

  7. php curl报错:417 - Expectation Failed

    当我在post提交的数据增加一段内容后会报错:417 - Expectation Failed. 查资料发现在使用curl做POST时,当post的数据大于1024字节时,curl并不会直接发起pos ...

  8. 配置web pack loader 报错:Module build failed: Error: The node API for `babel` has been moved to `babel-core`.

    报错如下 Module build failed: Error: The node API for `babel` has been moved to `babel-core`. 在我配置loader ...

  9. ssh 报错Host key verification failed 或Ubuntu connect to serve 失败

    ssh 报错Host key verification failed  或Ubuntu connect to serve 失败  通常是因为没有装ssh sudo apt-get install  o ...

随机推荐

  1. LeetCode:181.超过经理收入的员工

    题目链接:https://leetcode-cn.com/problems/employees-earning-more-than-their-managers/ 题目 Employee 表包含所有员 ...

  2. input框blur事件 ie问题

    在chrome和firefox里会返回 在ie却获取不到relatedTarget:可以通过document.activeElement获取到点击到哪个标签 注意document.activeElem ...

  3. Java Web系统架构概览

    大型网站系统架构的演进都是随着业务增长不断演进,所有的出发点都是为了满足业务需求.最初访问量下,功能简单时,单体软件可以解决所有问题:后来访问量逐渐增大,功能愈加丰富,此时单体软件的架构逐渐成为开发和 ...

  4. Oracle【序列、索引、视图、分页】

    1.Oracle序列语法:create sequence 序列名 特点1:默认是无值,指针指向没有值的位置 特点2:序列名.nextval 每次执行值会自增一次,步长为 1 特点3:序列名.currv ...

  5. STM32输出比较模式

    搜索好久,各种文章良莠不齐,转载以下几篇 http://www.eeworld.com.cn/mcu/article_2016101130334.html(输出比较冻结模式) http://www.e ...

  6. python函数:函数阶段练习

    1.写函数,用户传入修改的文件名,与要修改的内容,执行函数,完成批了修改的操作def modify_file(filename,old,new): import os with open(filena ...

  7. vim复制到剪切板

    作者:whinc链接:https://www.zhihu.com/question/19863631/answer/89354508来源:知乎 转载文章 Vim 中的复制.删除的内容都会被存放到默认( ...

  8. 2019.5.13-5.17知识点:文件管理、目录操作、索引节点、软硬链接,vim文本编辑 知识点

    文件管理 ● cp 复制文件 cp /路径(原文件) /路径(复制文件)/文件重命名(可选)    -i:覆盖前询问    -r:递归复制目录及内部内容   -a:归档,相当于-dr --preser ...

  9. 执行nvidia-smi出错

    执行nvidia-smi出错 NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make su ...

  10. DP tricks and experiences

    [LeetCode] 关于动态规划的经验与技巧. 很多时候多分配一位空间是为了递推的方便,例如前推两位. 辅助数组的索引,用到的可能是 1 — N,或者是 0 — N-1. 具体要看清 f[i] 每一 ...