我不明白如何在每次都输入密码的情况下将 git 与 HTTPS 一起使用?

  • 本文关键字:git 情况下 HTTPS 一起 密码 明白 git
  • 更新时间 :
  • 英文 :


据我所知,当您将git与https一起使用时,每次向github发出请求时都必须键入密码,除非您使用SSH或使用git-config-credential.helper store将凭据本地存储在计算机上。

我一直在使用HTTPS,但从不需要输入我的凭据。当我运行git-config-list时,它只显示我的电子邮件和我的名字,而不显示我的密码。有人能向我解释为什么不需要我输入密码,或者密码可以存储在哪里吗?

我一直在使用HTTPS,但从不需要键入凭据。

这可能是因为您的凭据已经被凭据助手缓存。

  1. 检查您的是什么:git config --global credential.helper
  2. 检查存储了哪些凭据:

在Git bash会话中:

printf "host=github.comnprotocol=https" | git-credential-xxx get

git config --global credential.helper返回的值替换xxx

如果它是空的,并且远程URL是HTTPS,那么,正如LeGEC在评论中所建议的那样,Git可能仍然使用SSH和url.<base>.pushInsteadOf指令
使用进行检查

git config --show-origin --list --show-scope | grep -i insteadOf

OP在评论中补充道:

运行git config --show-origin --list给了我file:/Applications/Xcode.app/Contents/Developer/usr/share/git-core/gitconfig credential.helper=osxkeychain
所以它看起来像是存储在我的osxkeychain中?

如果是这样的话:

printf "host=github.comnprotocol=https" | git-credential-osxkeychain get

另见";从macOS密钥链更新凭证";。

相关内容

最新更新