tshauck tshauck - 9 months ago 55
Git Question

More than one value for the key user.name Git

For some reason I'm getting the error that "More than one value for the key user.name" when I try to set the user.name for my git account. How can I set it to a single name?


Update (December 2012)

git1.8.1rc1 now operates differently:

"git config --get" used to diagnose presence of multiple definitions of the same variable in the same configuration file as an error, but it now applies the "last one wins" rule used by the internal configuration logic.

Strictly speaking, this may be an API regression but it is expected that nobody will notice it in practice.

Original answer (November 2010)

The git config man page mentions:

The variable names are case-insensitive and only alphanumeric characters and - are allowed.
There can be more than one value for a given variable; we say then that variable is multivalued.

Actually, such config settings (with multiple possible values) are called multivar

As Jefromi suggests, see in what of the 3 config files you have more than one user.name line.
You can query multiple values like so:

git config --get-all user.name          #local repo git config file)
git config --global --get-all user.name #user config file)
git config --system --get-all user.name #system git config file)

The one config file which answers more than one user.name value needs to be fixed.