Open inksnowhailong opened 10 months ago
You should run npx simple-git-hooks
. If this doesn't work please provide a repro example.
Hi! @inksnowhailong, thanks for reaching out. Please use English language in issues or pull requests, if I can be of help please rewrite your issue in english 🤝
me too
Hi! @inksnowhailong, thanks for reaching out. Please use English language in issues or pull requests, if I can be of help please rewrite your issue in english 🤝
@toplenboren I use this library in the mono repo and configure it in the sub-repository's package.json according to the official documentation, but it doesn't work before I commit. Why?
Hi, @ASCII26 do you have a reproduction example?
I have already solved this problem, which may serve as a reference.
git config core.hooksPath .git/hooks/
rm -rf .git/hooks
# Update ./git/hooks
npx simple-git-hooks
大概率你是从husky
迁移到simple-git-hooks
出现不可用的,我也出现这个问题。你可以按照README.md上提示,进行自检。参考:
huskygit 迁移时钩子未运行 为什么会发生这种情况?
Husky 可能会将core.gitHooks值更改为.husky,这样 git hooks 就会搜索.husky目录而不是.git/hooks/。
在Git 书中了解有关 git 配置的更多信息
你可以通过在你的 repo 中运行以下命令来检查它:
git config core.hooksPath
如果输出.husky,那么这就是你的情况
如何修复?
您需要将core.gitHooks值指向your-awesome-project/.git/hooks。您可以使用以下命令:
git config core.hooksPath .git/hooks/
验证值是否设置:
git config core.hooksPath
应该输出:.git/hooks/
然后删除.husky先前生成的文件夹husky。
安装了,初始化了,一切配置按照官网来了。但是我之间commit 就像没有它一样,之间就commit,没有执行我需要的命令