我如何在Windows上存储git的身份验证凭证



我试图使用此答案,但它不起作用。https://stackoverflow.com/a/5343146/148844

C:UsersChloeworkspacecatalyst_research>git --version
git version 2.15.1.windows.2
C:UsersChloeworkspacecatalyst_research>git config --global credential.helper manager
C:UsersChloeworkspacecatalyst_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:UsersChloeworkspacecatalyst_research>git config --global credential.helper "cache --timeout=2592000"
C:UsersChloeworkspacecatalyst_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:UsersChloeworkspacecatalyst_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

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

git config --global credential.helper manager

第二,当弹出窗口出现时,输入您的github帐户用户名/密码。

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

您可以在Windows凭据管理器中检查您的凭据确实与https://github.com正确关联。

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

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

i将git升级到2.16.3,并且起作用。

chocolatey upgrade git

最新更新