git:osxkeychain凭证助手默默无法记住用户名/密码 [英] git: osxkeychain credential helper silently fails to remember username/password

查看:1042
本文介绍了git:osxkeychain凭证助手默默无法记住用户名/密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此页面和许多人喜欢它给出了使用git设置osxkeychain凭证助手的说明。我遵循这些说明;一切似乎都很好。我可以看到我的用户名和密码在Keychain Access应用程序中是正确的,并且git-credential-osxkeychain可以访问github.com记录。当我键入 git config -l <​​/ code>时,我可以看到条目 credential.helper = osxkeychain 以及正确的user.name和user.email条目。当我运行 git credential-osxkeychain 时,我看到了我显然应该使用的用法消息。我从来没有收到错误信息。一切似乎设置正确。



但是,无论我git推特定存储库多少次,它总是要求我的用户名和密码。输入在我的钥匙串访问条目中找到的用户名和密码;所以它似乎不是一个登录问题。此外,当我键入 git credential-osxkeychain erase (或 git-credential-osxkeychain erase )时,该命令将静默挂起而且,据我所知,无限期地。

到目前为止,我还无法找到记录此问题的任何内容。 这个问题引发了类似的问题,但我的git版本是2.6.4,所以解决方案没有帮助。为什么它这样做,我该如何让git使用osxkeychain凭证助手记住我的用户名和密码?



我使用的是Mac OS X 10.11.4和git版本2.6.4。

解决方案

编辑〜/ .ssh / config 并为每个你想让钥匙串记住密码的主机添加 UseKeychain yes 。例如,如果你正在尝试为GitHub做到这一点:

 主机github.com 
IdentityFile〜/ .ssh / your_github_cert_rsa
UseKeychain yes

如果您想为每个主机启用它,只需添加:

 主机* 
UseKeychain是

这是Apple在macOS Sierra 10.12.2上添加的一项新要求,您可以在10.12.2中了解更多有关它的信息 man ssh_config

  UseKeychain 

在macOS上,指定系统是否应该搜索当尝试使用par-
特定密钥时,在用户的钥匙串中输入
密码。当用户提供密码短语时,该
选项还指定密码短语是否应该在钥匙串中存储
,一旦它被验证为正确。
参数必须是yes或no。默认是否。


This page and many like it gives instructions for setting up the osxkeychain credential helper with git. I've followed these instructions; everything seemed to work fine. I can see that my username and password in the Keychain Access application are correct and that git-credential-osxkeychain has access to the github.com record. When I type git config -l I can see the entry credential.helper=osxkeychain as well as correct user.name and user.email entries. When I run git credential-osxkeychain I see the usage message I'm apparently supposed to. At no point do I receive an error message. Everything seems to be setup correctly.

However, no matter how many times I git push a particular repository, it always asks for my username and password. Entering the username and password found in my Keychain Access entry works; so it does not appear to be a login issue. Additionally, when I type git credential-osxkeychain erase (or git-credential-osxkeychain erase), the command hangs silently and, as far as I can tell, indefinitely.

I have, as of yet, been unable to find anything documenting this issue. This question raises a similar issue, but my git version is 2.6.4, so the solution is not helpful. Why is it doing this and how do I get git to remember my username and password with the osxkeychain credential helper?

I'm using Mac OS X 10.11.4 and git version 2.6.4.

解决方案

Edit ~/.ssh/config and add UseKeychain yes to every host you want the Keychain to remember the password for.

For example, if you are trying to do this for GitHub:

Host github.com
    IdentityFile ~/.ssh/your_github_cert_rsa
    UseKeychain yes

If you want to enable it for every host, just add:

Host *
    UseKeychain yes

This is a new requirement, added by Apple on macOS Sierra 10.12.2, you can learn more about it running man ssh_config in 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''.

这篇关于git:osxkeychain凭证助手默默无法记住用户名/密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆