今天在向GitHub仓库提交代码的时候收到了这封邮件,说是使用密码的认证将要被舍弃了,提醒我换成两步验证(2FA),切换成两步验证很顺利,突然很好奇GitHub密码在Mac上是怎么保存的
vscode的设置里有两个选项,如下图
保存密码的地方如下图:
正常克隆
keychain中自动添加github.com login
正常克隆
keychain中没有自动添加vscodevscode.github-authentication
同场景四
同场景四
同场景一
同场景二
成功clong
keychain中自动添加github.com login,没有自动添加vscodevscode.github-authentication
而且我的PAT也是空的
(感觉这里github.com login是从某个类似缓存的地方添加进来的,这应该是个bug,因为这会导致无法完全与GitHub解绑,参考这个issue:https://github.com/Azure/azure-sdk-for-js/issues/11778)
查看credential.helper
>>> git config --get --show-origin credential.helper
file:/Applications/Xcode.app/Contents/Developer/usr/share/git-core/gitconfig osxkeychain
>>> git config --list --show-origin
file:/Applications/Xcode.app/Contents/Developer/usr/share/git-core/gitconfig credential.helper=osxkeychain
file:/Users/microfat/.gitconfig user.email=[email protected]
file:/Users/microfat/.gitconfig user.name=microfat
file:/Users/microfat/.gitconfig core.excludesfile=/Users/microfat/.gitignore_global
参考:
https://stackoverflow.com/questions/16052602/disable-git-credential-osxkeychain
https://docs.github.com/cn/free-pro-team@latest/github/using-git/caching-your-github-credentials-in-git