git 如何删除git钩子
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39963695/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to remove git hooks
提问by Ali Farhoudi
I had set up a git hook in pre-commit file to run git pull
before any commit. Now I have deleted that file and restarted my computer multiple times, but that hook is still running before my commits.
我在预提交文件中设置了一个 git 钩子,以便git pull
在任何提交之前运行。现在我已经删除了该文件并多次重新启动了我的计算机,但是在我提交之前该钩子仍在运行。
How can I remove or disable that completely?
如何完全删除或禁用它?
回答by Ali Farhoudi
I figured out what was causing that:
I had created my pre-commit
hook in git core directory, but the git had created a pre-commit hook in project's .git/hooks/
directory. I just removed it.
我弄清楚是什么原因造成的:
我pre-commit
在 git 核心目录中创建了我的钩子,但是 git 在项目.git/hooks/
目录中创建了一个预提交钩子。我刚刚删除了它。
回答by roger
Based on the documentation, git hooks should reside in $GIT_DIR/hooks/
- verify this dir does not contain the pre-commit
hook file
根据文档,git hooks 应该位于$GIT_DIR/hooks/
- 验证此目录不包含pre-commit
钩子文件
If the problem persists, you could flag your git commit
with --no-verify
(that should bypass the pre-commit hook)
如果问题仍然存在,您可以标记您git commit
的--no-verify
(应该绕过预提交挂钩)
Information can be found at:
信息可以在以下位置找到: