“git config --list” shows duplicate names

2020-06-30 05:12发布

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.

标签: git
1条回答
狗以群分
2楼-- · 2020-06-30 05:46

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.

查看更多
登录 后发表回答