More than one value for the key user.name Git

后端 未结 7 1019
再見小時候
再見小時候 2020-12-12 20:32

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 n

7条回答
  •  旧时难觅i
    2020-12-12 20:42

    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.

提交回复
热议问题