【问题标题】:How do I stored the authentication credentials for Git on Windows?如何在 Windows 上存储 Git 的身份验证凭据?
【发布时间】:2018-09-11 04:50:06
【问题描述】:

我尝试使用此答案,但没有成功。 https://stackoverflow.com/a/5343146/148844

C:\Users\Chloe\workspace\catalyst_research>git --version
git version 2.15.1.windows.2

C:\Users\Chloe\workspace\catalyst_research>git config --global credential.helper manager

C:\Users\Chloe\workspace\catalyst_research>git pull

此时会弹出一个GUI对话框。

fatal: HttpRequestException encountered.
   An error occurred while sending the request.
fatal: HttpRequestException encountered.
   An error occurred while sending the request.
Username for 'https://github.com': email@domain.com
Password for 'https://email@domain.com@github.com':
remote: Counting objects: 10, done.
...
 2 files changed, 11 insertions(+), 5 deletions(-)

C:\Users\Chloe\workspace\catalyst_research>git config --global credential.helper "cache --timeout=2592000"

C:\Users\Chloe\workspace\catalyst_research>git pull
fatal: HttpRequestException encountered.
   An error occurred while sending the request.
git: 'credential-cache' is not a git command. See 'git --help'.
Username for 'https://github.com': email@domain.com
Password for 'https://email@domain.com@github.com':
git: 'credential-cache' is not a git command. See 'git --help'.
Already up to date.

C:\Users\Chloe\workspace\catalyst_research>git pull
fatal: HttpRequestException encountered.
   An error occurred while sending the request.
git: 'credential-cache' is not a git command. See 'git --help'.
Username for 'https://github.com': ^C

【问题讨论】:

    标签: windows git github


    【解决方案1】:

    首先,让经理作为凭证助手:

    git config --global credential.helper manager
    

    其次,当弹出窗口出现时,输入你的 GitHub 帐户用户名/密码。

    然后,后续的 Git 命令不会再次要求您提供凭据。

    如果您的凭据确实与https://github.com 正确关联,您可以签入Windows Credential Manager

    Username for 'https://github.com': email@domain.com
    

    注意:您的 GitHub 用户名应该是您的 GitHub 帐户用户名,不是 email@domain.com

    【讨论】:

      【解决方案2】:

      我将 Git 升级到 2.16.3 版,它运行正常。

      chocolatey upgrade git
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2010-12-08
        • 2018-03-25
        • 1970-01-01
        • 2012-09-06
        • 2015-11-06
        • 2016-07-07
        相关资源
        最近更新 更多