GitHub error:user.name has multiple values

在配置 GitHub 输入以下命令时:

1
2
git config --global user.name "Your Name"
git config --global user.email "email@example.com"

报错:

1
2
3
4
git config --global user.name *******
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.

解决方案:

输入以下命令查看 Git 配置信息:

1
git config --list

结果如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
rebase.autosquash=true
http.sslcainfo=E:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
credential.helper=manager
user.name=*********
user.name=**
user.email=****

发现 user.name 有多个值,然后输入以下命令解决问题:

1
git config --global --replace-all user.email "输入你的邮箱" 
1
git config --global --replace-all user.name "输入你的用户名"

然后再查看下 Git 配置

1
git config --list 

发现修改成功了。