Git user.name configuration not working

I installed Git for Windows 7 today. I don't know anything about Git yet, and I follow http://git-scm.com/book/en/Getting-Started-First-Time-Git-Setup and a YouTube video on this. In the videos, people install Git and go to the command line and use

git config --global user.name = "My Name" 

and

 git config --global user.email = " email@example.com " 

and creates a .gitconfig file in C:/Users/admin/.gitconfig with the correct values ​​for them.

After executing the above lines of code three times, this is what I got in this file:

 [user] name = = email = = name = = 

Why doesn't it work? I followed the official tutorial and I see that it works for other people on YouTube, but not for me.

+10
git git-config
source share
3 answers

You do not use the correct syntax: between user.name and "My name" or between user.email and " email@example.com " there should not be a sign " email@example.com " . For example, when you run

 git config --global user.name = "My Name" 

the command interprets the = character as the string value passed to user.name , and the rest of the string ( "My Name" ) is ignored. This is why your .gitconfig file contains

 [user] name = = email = = 

Everything should work if you use the correct syntax:

enter image description here

+19
source share

There are no "=" parameters for user.name and user.email parameters, just use spaces. On the same page -

The first thing you need to do when installing Git is to provide a username and email address. This is important because every Git commit uses this information, and its invariably baked to the commit you pass:

  • $ Git config --global user.name "John Doe"
  • $ Git config --global user.email johndoe@example.com
+6
source share

Note. Such a syntax error ( git config --global user.email = " email@example.com " ) would be better reported using Git 2.13+ (Q2 2017)

See commit 9442555 , commit 13b9a24 , commit 862e80a , commit afb6c30 (February 23, 2017) by Jeff King ( peff ) .
(merger of Junio ​​C Hamano - gitster - to commit 066c38c , March 10, 2017)

user.email , which consists only of cool characters, should sequentially fail, but did not.

This means that this will happen now:

 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 
+2
source share

All Articles