Git configuration user.name doesn't work
You're not using the correct syntax: there shouldn't be any equal sign between user.name
and "My name"
, or between user.email
and "[email protected]"
. For instance, when you run
git config --global user.name = "My Name"
the command interprets the =
character as the string value passed to the user.name
key, and the rest of the line ("My Name"
) is silently ignored. That's why your .gitconfig
file ends up containing
[user]
name = =
email = =
Everything should work if you use the correct syntax:
See also VonC's answer about relevant changes in Git 2.13.
There is no "=" for the parameters user.name and user.email, just use spaces. From the same page -
The first thing you should do when you install Git is to set your user name and e-mail address. This is important because every Git commit uses this information, and it’s immutably baked into the commits you pass around:
- $ git config --global user.name "John Doe"
- $ git config --global user.email [email protected]
Note: that kind of syntax error (git config --global user.email = "[email protected]"
) will be better reported by Git 2.13+ (Q2 2017)
See commit 9442555, commit 13b9a24, commit 862e80a, commit afb6c30 (23 Feb 2017) by Jeff King (peff
).
(Merged by Junio C Hamano -- gitster
-- in commit 066c38c, 10 Mar 2017)
user.email
that consists of only cruft chars should consistently error out, but didn't.
That means this will now fail:
GIT_AUTHOR_NAME=" .;<>" git commit --allow-empty -m foo
fatal: name consists only of disallowed characters: .;<>
GIT_AUTHOR_EMAIL="" GIT_AUTHOR_NAME="" git commit --allow-empty -m foo
fatal: no email was given and auto-detection is disabled