【问题标题】:Git More than one value for the key user.name/emailGit 键 user.name/email 的多个值
【发布时间】:2013-04-27 19:58:06
【问题描述】:

问题 1. 当我运行命令时

$ git config --global user.name
# or
$ git config --global user.email

我收到以下错误消息:

error: More than one value for the key user.name/email

因此,我似乎针对我的用户名和电子邮件存储了多个值。我想在每个中存储一个值。

问题 2。 针对我在 github 上的提交显示的名称未链接到我的帐户。表示未超链接其被阻止。

我搜索了很多,但对我的问题没有满意的结果。任何人都可以帮忙。

【问题讨论】:

    标签: ruby-on-rails git configuration github


    【解决方案1】:

    您使用的是 Windows 还是基于 Unix 的系统?如果您在基于 Unix 的系统上,您可以检查配置文件中的配置。转到您的主文件夹,在那里应该有一个名为 .gitconfig 的隐藏文件,打开它并查看您那里有什么信息。可能文件有错误。

    【讨论】:

      【解决方案2】:

      看看 ~/.gitconfig

      我猜你的应该是这样的:

      ...
      [user]
        name = Sami
        email = xxx@xx.com
        name = Sami
        email = xxx@xxx.com
      ....
      

      只需删除重复条目即可删除该消息。

      关于链接到github,查看this answer

      【讨论】:

      • 当我运行命令 git config --get-all user.name 我看到类似 Sami Ulhaq Sami ul haq user.email xxx@gmail.com [branch
      • 感谢双重名称和电子邮件问题已解决...我还删除了备用电子邮件现在让我们看看发生了什么... :-)
      【解决方案3】:
      git config -l #shows you what name, email and other stuff is saved
      cat ~/.gitconfig #shows you samething(what's saved in your /home/username/.gitconfig)
      
      要更改机器中现有提交的内容,您可以在命令行上尝试:
      $ git config user.name "Your Name"
      $ git config user.email "your@address.com"
      $ git submodule foreach --recursive 'git config user.name "Your Name" && git config    user.email "your@address.com"'
      

      ....在这里看到休息:https://gist.github.com/carlosmcevilly/2221249

      ps:如果你已经提交了东西并且想要 snyc 与 github,那么再问一个问题(那是单独的问题)

      【讨论】:

        【解决方案4】:

        问题1的解决方案: 首先看一下配置中列出的内容:

        git config --list

        示例输出:

        enter code here
        
        user.email=abarker@cern.ch
        user.name=fiveisgreen
        user.github=fiveisgreen
        user.name=Anthony
        

        在本例中,user.name 列出了两次。要删除重复项:

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

        【讨论】:

          猜你喜欢
          • 2011-05-17
          • 2020-08-09
          • 1970-01-01
          • 2020-08-20
          • 1970-01-01
          • 2018-08-30
          • 2017-06-29
          • 2012-11-24
          • 1970-01-01
          相关资源
          最近更新 更多