Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"git config --list" shows duplicate names

Tags:

git

git config --list shows two values for user.name, one global, one local:

user.name=My Name
...
user.name=My Other Name
...

My understanding is that local values override global ones. How can I get git config to only show the values that are actually in effect? I only want to see one value of user.name -- the one that will be used if I commit in the current context.

If my question is based on a misunderstanding, or if this is caused by something wrong with my git install, that would also be very helpful.

like image 416
Roofus Avatar asked Aug 13 '16 03:08

Roofus


1 Answers

On Git version 2.8.0 and above, you can type

git config --list --show-origin

to show the origin of the individual configuration entry.

Order of preference is local > global > system. So local configuration will be preferred over global if present.

like image 101
Abhay Saraf Avatar answered Oct 19 '22 09:10

Abhay Saraf