toplenboren / simple-git-hooks

A simple git hooks manager for small projects
MIT License
1.34k stars 43 forks source link

完全无效 #101

Open inksnowhailong opened 10 months ago

inksnowhailong commented 10 months ago

安装了,初始化了,一切配置按照官网来了。但是我之间commit 就像没有它一样,之间就commit,没有执行我需要的命令

awxiaoxian2020 commented 9 months ago

You should run npx simple-git-hooks. If this doesn't work please provide a repro example.

toplenboren commented 8 months ago

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 🤝

like0413 commented 5 months ago

me too

ASCII26 commented 2 months ago

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?

toplenboren commented 2 months ago

Hi, @ASCII26 do you have a reproduction example?

Jun2030 commented 4 weeks ago

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
mmdapl commented 2 weeks ago

大概率你是从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。