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