名称和电子邮件在Git的每用户配置文件中设置,但是Git仍使用默认的生成名称和电子邮件 [英] Name and email set in Git's per-user configuration file, however Git is still using the default generated name and email
问题描述
标题说明了这一点,但我将对其进行更彻底的解释:
The title says it, but I will explain it more thoroughly:
我已使用推荐的命令配置了用户名和电子邮件:
I have configured my user's name and email as recommended using the commands:
git config --global user.name
git config --global user.email
我可以通过执行 git config --global --list
来验证此设置得到以下输出:
I can verify that this is set by doing git config --global --list
and I get the following output:
core.user=Joshua Guerra
core.email=joshua@allianceconsults.net
core.editor=nano
push.default=simple
我也可以验证它通过执行 cat〜/ .gitconfig
,其中输出为:
I can also verify it by doing cat ~/.gitconfig
, where the output is:
# This is Git's per-user configuration file.
[core]
# Please adapt and uncomment the following lines:
user = Joshua Guerra
email = joshua@allianceconsults.net
[core]
editor = nano
[push]
default = simple
所以,我有验证其设置正确。但是,当我提交时,我仍然收到一条消息,提示:
So, I have verified that it is set properly. However I still get a message when I commit that says:
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 you@example.com
在您说之前,这只是为将来的提交设置值,请理解,我理解。另外,我已经设置了此值,并反复收到消息,即使我设置完值并在每次提交内容时都进行了设置,也没有设置值。
And before you say, this only sets the values for future commits, understand that I understand that. Also, I have set this and repeatedly gotten the message that the values were NOT set even AFTER I set them and verified each time that they were set when I go to commit something.
为什么我的系统不断向我发送此消息,我感到茫然。如果您需要有关我所使用的版本和系统的更多信息,我们很乐意根据要求提供它。
I'm at a loss for why my system keeps giving me this message. If you need more info about what version and system I am on, I am happy to provide it upon request.
推荐答案
名称
和电子邮件
设置应显示在 [user]
部分〜/ .gitconfig
。它们的设置不正确。您的〜/ .gitconfig
可能是由于运行以下命令导致的:
The name
and email
settings should appear in the [user]
section of ~/.gitconfig
. They are not set correctly. Your ~/.gitconfig
could have resulted from running the commands:
git config --global core.user "Joshua Guerra"
git config --global core.email joshua@allianceconsults.net
应该运行的命令是:
git config --global user.name "Joshua Guerra"
git config --global user.email joshua@allianceconsults.net
到验证设置是否正确,运行 git config --global --list
并检查输出:
To verify that the settings are correct, run git config --global --list
and check the output for:
...
user.name=Joshua Guerra
user.email=joshua@allianceconsults.net
...
这篇关于名称和电子邮件在Git的每用户配置文件中设置,但是Git仍使用默认的生成名称和电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!