我们已经在测试服务器上创建了代码分支,多个用户现在正在通过 SSH 连接到新服务器并使用命令行进行所有提交来处理该代码。但是,Git 当然不知道是谁进行了更改并提交了这些更改,因此我们需要在提交期间指定作者。
我认为我们可以通过以下方式实现这一目标:
git commit -a -m 'removed temporary images' --author='deed02392 <[email protected] /cdn-cgi/l/email-protection>'
但这给出了:
[test-branch 77b9357] removed temporary image
Author: deed02392 <[email protected] /cdn-cgi/l/email-protection>
Committer: root <root@vs123.(none)>
Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly:
git config --global user.name "Your Name"
git config --global user.email [email protected] /cdn-cgi/l/email-protection
If the identity used for this commit is wrong, you can fix it with:
git commit --amend --author='Your Name <[email protected] /cdn-cgi/l/email-protection>'
1 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 derp.PNG
期望每个用户每次都更改配置似乎太过分了。出现这种行为是因为 Git 的设计目的不是让多个用户使用一个存储库吗?
只要所有用户使用不同的系统帐户,运行
git config --global user.***
每个用户一次应该解决问题,即使所有用户都在同一个存储库上工作,
因为这些设置是特定于用户的并保存在$HOME/.gitconfig
.
(当然)如果他们su
在运行 git 之前到 root 或其他共享帐户。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)