1
$ 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

3
  • 2
    What specific questions does the Description of the git config command leave? Commented Dec 9, 2022 at 3:15
  • every git command has a help page you can access with git help <command>, the page linked by jthill is git help config. These pages are also accessible from the official git site, starting from git-scm.com/docs and searching for target command, or by directly accessing https://git-scm.com/docs/git-<command> (again: jthill's link point to that official page). The only thing with the website is : compare your local git version (git version) with the version of the doc you are looking at (the website shows the latest version by default) Commented Dec 9, 2022 at 5:31
  • Learn to use search: stackoverflow.com/a/33638880/7976758 Found in stackoverflow.com/… Commented Dec 9, 2022 at 9:26

3 Answers 3

5

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).

Sign up to request clarification or add additional context in comments.

Comments

1

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" 

Comments

0

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.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.