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 报错了。

相关推荐
ShineWinsu23 分钟前
对于Git:远程操作的超详细保姆级解析
linux·git·gitee·github·远程仓库·分布式版本控制系统·远程操作
梦帮科技1 小时前
从 Guest 到 Platinum:Prompt 配额、API Key 与访问控制的安全闭环
javascript·git·架构·node.js·reactjs·html5·visual studio
zho_uzhou18 小时前
Git入门概念
git
爱奥尼欧1 天前
【Git】远程分支删了本地还在、两个分支历史不相干?两招故障排解
开发语言·git
Java后端的Ai之路1 天前
Git冲突完整排查与实战:本地修改覆盖报错到成功推送全流程复盘
开发语言·人工智能·git·python·pop
一个心烑1 天前
配置项目git的 SSL 证书
git·网络协议·ssl
IT从业者张某某1 天前
【鸿蒙PC命令行适配】GitUI 移植的工程实践:双 Git 引擎(libgit2/gitoxide)的鸿蒙适配之路
git·华为·harmonyos
xinjia_ctrl2 天前
暑假实习总结
git·后端·spring·maven·intellij-idea
Molesidy2 天前
【Git】分别给出添加到Keil工程和IAR工程中的gitnore文件以便不跟踪编译文件的git记录
git·vscode·插件
颜颜yan_2 天前
Git Cola 鸿蒙 PC 版适配全记录:从 Qt 桌面工具到 ArkTS 原生应用
git·qt·harmonyos