Bra*_*yen 6 git git-config git-commit
在尝试提交存储库时,我收到错误:
$ git commit
*** Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got '[output redacted]')
Run Code Online (Sandbox Code Playgroud)
显而易见的解决方案是git config在输出中运行选项,但我不想这样做.
有问题的计算机不属于特定的人,而是共享计算机.因此,每个提交将是不同的用户.
如何绕过这个并将作者设置为每次提交而不是全局?
Cod*_*ard 11
另一种选择是使用该-c标志将config参数传递给当前命令.
在你的情况下 git -c user.email="your@email.com" -c user.name="Your Name" commit ...
这些-c值会覆盖任何其他默认值(set和unset参数).请注意,所有-c选项都需要在命令名称之前commit.
您可以使用该--author标志:
$ git commit --author="A U Thor <author@example.com>"
Run Code Online (Sandbox Code Playgroud)