nbe*_*ben 14 git authentication macos credentials github
这个页面和许多相似的页面给出了使用git设置osxkeychain凭证助手的说明.我遵循了这些指示; 一切似乎都很好.我可以看到Keychain Access应用程序中的用户名和密码是正确的,git-credential-osxkeychain可以访问github.com记录.当我输入时,git config -l
我可以看到该条目credential.helper=osxkeychain
以及正确的user.name和user.email条目.当我跑步时,git credential-osxkeychain
我看到我显然应该使用的用法消息.在任何时候我都不会收到错误消息.一切似乎都正确设置.
但是,无论我多少次git推送特定的存储库,它总是要求我的用户名和密码.输入我的Keychain Access条目中的用户名和密码有效; 所以它似乎不是登录问题.另外,当我输入git credential-osxkeychain erase
(或git-credential-osxkeychain erase
)时,命令会无声地挂起,就我所知,无限期.
到目前为止,我还没有找到任何记录此问题的内容.这个问题提出了类似的问题,但我的git版本是2.6.4,所以解决方案没有帮助.为什么这样做?如何让git用osxkeychain凭证助手记住我的用户名和密码?
我使用的是Mac OS X 10.11.4和git 2.6.4版.
and*_*ieb 14
编辑~/.ssh/config
并添加UseKeychain yes
到您希望Keychain记住密码的每个主机.
例如,如果您尝试为GitHub执行此操作:
Host github.com
IdentityFile ~/.ssh/your_github_cert_rsa
UseKeychain yes
Run Code Online (Sandbox Code Playgroud)
如果要为每个主机启用它,只需添加:
Host *
UseKeychain yes
Run Code Online (Sandbox Code Playgroud)
这是Apple在macOS Sierra 10.12.2上添加的新要求,您可以man ssh_config
在10.12.2中了解更多有关它的信息:
UseKeychain
On macOS, specifies whether the system should search for
passphrases in the user's keychain when attempting to use a par-
ticular key. When the passphrase is provided by the user, this
option also specifies whether the passphrase should be stored
into the keychain once it has been verified to be correct. The
argument must be ``yes'' or ``no''. The default is ``no''.
Run Code Online (Sandbox Code Playgroud)
在Mac OS 10.11下,您可以检查是否已使用变量禁用了钥匙串
KeychainIntegration
Specifies whether to enable Keychain support on Mac OS X.
If Keychain support is enabled, then passwords for identities can be
managed via the Mac OS X Keychain.
The value for this keyword must be ``yes'' or ``no''. The default is ``yes''.
AskPassGUI
Show the system password prompt
Run Code Online (Sandbox Code Playgroud)