据我所知,当您将git与https一起使用时,每次向github发出请求时都必须键入密码,除非您使用SSH或使用git-config-credential.helper store将凭据本地存储在计算机上。
我一直在使用HTTPS,但从不需要输入我的凭据。当我运行git-config-list时,它只显示我的电子邮件和我的名字,而不显示我的密码。有人能向我解释为什么不需要我输入密码,或者密码可以存储在哪里吗?
我一直在使用HTTPS,但从不需要键入凭据。
这可能是因为您的凭据已经被凭据助手缓存。
- 检查您的是什么:
git config --global credential.helper
- 检查存储了哪些凭据:
在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密钥链更新凭证";。