解决 git 中【user.name has multiple value】的错误

git 中,有时在使用以下命令行时

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

报下面的错误:

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 config --list// 这条指令可以查看到 git 相关配置信息,可以看到已经无意间添加了多个 name 值

这时,发现是因为user.name有多个值导致的

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=*********
解决方法:
$ git config --global --replace-all user.name "你的 git 的名称"
$ git config --global --replace-all uesr.email "你的 git 的邮箱"

做完这一步,再键入 $ git config --list 会发现 name 和 email 只有一个值了,这时候就不会报错了。

  • 18
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值