【问题标题】:--global@github.com is coming up when I try to push my code to github--global@github.com 在我尝试将代码推送到 github 时出现
【发布时间】:2019-04-23 01:25:19
【问题描述】:

我找不到这个问题的答案,也许我只是在这里盲目地错过了一步,但是每当我尝试将我的代码推送到 github 并使用git push -u origin master 时,它都会提示密码为“--global@ github.com”:

我输入我的帐户密码,它显示

Password for 'https://--global@github.com': 
remote: Invalid username or password.
fatal: Authentication failed for 
'https://github.com/richardquirarte/QRealty.git/'

我已经使用过 git config --global user.email 并验证这是我的电子邮件,但它一直在提示。

再次抱歉,如果这是一个简单的解决方法,我只是无法在任何地方找到答案。谢谢。

【问题讨论】:

    标签: git github


    【解决方案1】:

    你可能有一些错误的配置。

    先尝试重置远程 URL 和您的用户名:

    git config --global user.name "some user name"
    git remote set-url origin https://github.com/richardquirarte/QRealty.git
    

    【讨论】:

    • 使用 GitHub,您必须使用 GitHub 凭据。与那些设置无关,这些设置仅用于提交代码
    • @CodeWizard 但无论如何,问题似乎在于 HTTP 身份验证用户名设置为 --global,这可能是其他一些问题。
    【解决方案2】:

    这看起来像 git config --global 出错了。

    试试git config -l | grep global,看看有没有“global”的配置。

    如果没有,请检查您的 git config credential.helper,看看您是否必须删除与 GitHub URL 关联的用户 --global(请参阅“problem while I was pushing my code to github.com”)。

    【讨论】:

      【解决方案3】:

      这是一个迟到的答案,但我遇到了同样的问题并想通了。 我不小心将我的凭据用户名设置为 --global ,所以当我被提示登录时,我被提示登录到 --global@github.com。

      解决这个问题:

      git config --global credential.username "your github username here"
      

      确保凭证用户名正确:

      git config -l
      

      现在推送您的代码。

      git push 
      

      【讨论】:

        【解决方案4】:

        您正在使用 https,它需要密码才能与服务器进行任何交互。
        解决它并不难,但我建议您切换到 ssh,您将不再需要使用密码。

        阅读他的文档以了解如何操作。
        https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/

        简而言之:

        • 生成 ssh 密钥 打开 git bash 并输入:ssh-keygen
        • 创建 ket 后复制它(公共的路径将打印在您的终端中)
        • 将密钥添加到您的 GitHub 帐户
        • 将 repo URL 更新为您的新 URL

          git remote set-url origin <ssh url>
          

        【讨论】:

        • 答案与问题无关。问题是关于本地 .git/config 中的错误远程 URL。
        猜你喜欢
        • 2016-03-18
        • 1970-01-01
        • 2012-11-06
        • 2020-01-08
        • 2016-11-04
        • 2020-02-06
        • 2020-01-21
        • 2021-09-04
        • 1970-01-01
        相关资源
        最近更新 更多