You should examine the contents of ~/.gitconfig (your user-global config) as well as .git/config in the repository in question (the repo-specific config). You should see two name lines under a user section in one of them. (It could also be two separate user sections in one file.) Just delete the one you don't want, and you should be good to go.
You could also directly set it with git config --global user.name "Desired name" if you want it to be a global setting (probably the case), or the same minus the --global for a repo-specific setting - but it's probably best to inspect the files and find the culprit yourself, to make sure you know what you have. The repo-specific one will override the global one. Ideally you should set your name globally, and only override it in a project for a good reason.
"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:
The one config file which answers more than one user.name value needs to be fixed.
From the comments:
Examining files "local", "global" and "settings" I can see only one user.name in global.
But git config --list and git config --get-all user.name gives it twice to me
One you see where the duplicate setting is (local, global, system), you can use git config [--local/--global/--system] --replace-all key value, as in mb21's answer.
This thread helped me a great deal. Here is what I did to resolve a duplicate key entry in my global config settings. Windows 7. I searched for a file called .gitconfig which was located in /users/owner on my system. I edited it with a text editor (Atom) and removed the offending line.
I believe the duplicate key was set when I inadvertently enclosed my email address in quotes while using the git config command, at least that's what my shell log indicates. Ooops!
Now go to your C:\Users[Your PC User Name] and search for the file .gitconfig (It is a hidden file. Make sure to enable view hidden files option).
After finding the file open it. Now remove all the duplicate fields of user.name and user.email.
You can now either set your user.name and user.email with code