git commit报错No .pre-commit-config.yaml file was found

1.报错内容

bash 复制代码
$ git commit
No .pre-commit-config.yaml file was found
- To temporarily silence this, run `PRE_COMMIT_ALLOW_NO_CONFIG=1 git ...`
- To permanently silence this, install pre-commit with the --allow-missing-config option
- To uninstall pre-commit run `pre-commit uninstall`

2.报错原因

原因是仓库里的 pre-commit 配置删掉了,但你本地的 .git/hooks/pre-commit 还在,它提交时仍然会去找 .pre-commit-config.yaml。

bash 复制代码
pre-commit uninstall

并确认 .git/hooks/pre-commit 已经不存在。现在再跑:

bash 复制代码
git commit

就不会再因为缺少 .pre-commit-config.yaml 报错了。

相关推荐
InfinitePlus1 小时前
Git基本操作-命令行
git
茉莉玫瑰花茶2 小时前
TCP 全连接队列与 tcpdump 抓包
git·github·tcp·tcpdump
炸膛坦客3 小时前
Git 和 GitHub:(十四)rebase 到某个有新提交的远程仓库的分支
git·github
炸膛坦客18 小时前
Git 和 GitHub:(十二)基于远程仓库的某一个分支的某一笔提交创建新分支
git·github
炸膛坦客19 小时前
Git 和 GitHub:(十三)改分支名
git·github
他们叫我秃子19 小时前
Git 使用指南笔记:从入门到团队协作
git
铁锚1 天前
Git设置自动推送到同名远端分支
git
起个破名想半天了1 天前
Git 本地项目关联远程仓库教程
git·github·git教程
lazy H1 天前
Git worktree 怎么用?同时开发多个分支完整教程
大数据·git·后端·学习·搜索引擎·github
重生的黑客1 天前
Git 本地版本管理与分支管理:从零理解工作区、回退、冲突与开发流程
数据库·git·elasticsearch