Name and email set in Git's per-user configura

2019-05-09 16:10发布

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

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

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.

标签: git config
1条回答
手持菜刀,她持情操
2楼-- · 2019-05-09 16:40

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

The commands that should have been run are:

git config --global user.name "Joshua Guerra"
git config --global user.email joshua@allianceconsults.net

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
...
查看更多
登录 后发表回答