Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git configuration user.name doesn't work

Tags:

I installed Git for Windows 7 today. I don't know much about Git yet and I'm following http://git-scm.com/book/en/Getting-Started-First-Time-Git-Setup and videos from YouTube on that subject. On 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 protected]" 

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

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

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

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

like image 795
Jimsea Avatar asked Aug 31 '14 14:08

Jimsea


People also ask

Why git config is not working?

Try opening it and see do this file look like this. Try setting global config through command line by- git config --global user. email "[email protected]" It automatically set the . gitconfig in the directory it needed.

Can we configure username in git?

About Git usernamesYou can change the name that is associated with your Git commits using the git config command. The new name you set will be visible in any future commits you push to GitHub from the command line. If you'd like to keep your real name private, you can use any text as your Git username.


1 Answers

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:

enter image description here

See also VonC's answer about relevant changes in Git 2.13.

like image 137
jub0bs Avatar answered Oct 18 '22 17:10

jub0bs