为什么git不能添加.git / hooks / my-hook [英] why it is not possible to git add .git/hooks/my-hook
问题描述
我想有一些钩子总是出现在给定仓库的克隆中。有没有办法在存储库中的.git / hooks中添加文件?
谢谢
可以在 git模板 ,但即使在那里,那些钩子也是不可执行的。
Ie一旦repo被克隆,用户将仍然必须激活它们(重命名或激活可执行位)。
这样,所述用户在没有他/她的全部知识的情况下不会执行任何不需要的脚本,并且明确的批准。
这样做会对任何人造成太大的安全风险盲目克隆回购。
I would like to have some hooks always present in a clone of a given repository. Is there a way to add a file in .git/hooks in the repository?
Thanks
It is possible to define your own hooks in a git template, but even there, those hooks would be non-executable ones.
I.e. the user would still have to activate them (rename or activate the executable bit) once the repo is cloned.
That way, said user won't have any unwanted script executed without his/her full knowledge and explicit approval.
Doing otherwise would be too much of a security risk for anyone "blindly" cloning a repo.
这篇关于为什么git不能添加.git / hooks / my-hook的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!