Home > database >  How to fix multiple values error in git while configuring the name?
How to fix multiple values error in git while configuring the name?

Time:12-09

$ git config --global user.name "Amritjyot Singh"
warning: user.name has multiple values
error: cannot overwrite multiple values with a single value
       Use a regexp, --add or --replace-all to change user.name.

How to use regexp to fix this problem?

I tried git config --global user.name "Amritjyot Singh" Expected to configure my name in git bash but this error was shown

CodePudding user response:

For some reason, you have multiple user.name configuration keys. Remove them all with:

git config --global --unset-all user.name

Then set it again:

git config --global user.name "Your Name"

CodePudding user response:

To see where different values for a config parameter are defined :

$ git config --show-origin --get-all user.name
# sample output:
file:/home/wwhite/.gitconfig   Walter White
file:.git/config  Heisenberg

If you see several values coming from one single file:

file:/home/jack/.gitconfig   Jack
file:/home/jack/.gitconfig   Tyler Durden

you can either

  • edit the mentioned configuration file with a regular text editor, and delete the erroneous value,
  • or use :
git config [correct scope] --replace-all user.name "My Name"

where [correct scope] will probably be --global (if source is in $HOME/.gitconfig) or --local (<- same as empty string, if source is .git/config).

CodePudding user response:

Run git config --global -e to edit the global config file. According to the warning and error messages, there are multiple values like this

[user]
    name = foo

Find all of them, keep one and remove the others.

  • Related