问题描述
我的计划是使用git跟踪/ etc中的更改,但是当提交时,我希望让更改的人通过在命令行中添加--author选项来指定自己为作者。
My plan is to use git to keep track of changes in /etc but when committing I want to have the person making the change specify themselves as author by adding the --author option on the commandline.
所以我想停止以root身份进行意外提交。
So I would like to stop accidental commits as root.
我试图创建这个预先提交的钩子,但它不工作 - git即使我在提交行指定了作者,var仍然会返回root。
I tried creating this pre-commit hook but it is not working - git var is still returning root even if I specify the author on commit line.
之前请求他们设置这些环境变量(使用通过 - author 传递的值) / code>钩子。Unfortunately, setting these variables is much less convenient than using --author. I suggest contacting the Git developers and requesting that they set these environment variables (using the value passed via --author) before launching the pre-commit hook.
这篇关于使用预先提交钩子停止特定作者的git提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!