更新到 macOS Sierra 后,git 无法在钥匙串(keychain)中找到证书

标签 git macos ssl macos-sierra

升级到 macOS 10.12 Sierra 后,我无法与加密的 SSL git 服务器同步。通过 Safari 访问服务器时,证书仍然可以正常工作。

我在尝试推送到服务器时收到此消息:

fatal: unable to access 'https://....': SSL: Can't find the certificate "...." and its private key in the Keychain.

证书在钥匙串(keychain)中,名称正确(更新前有效),但不知何故我无法访问它。

我的 ~/.gitconfig 文件仍然包含以下内容:

[http "https://...."]
    sslCert = ....
[credential]
    helper = osxkeychain

到目前为止还有其他人遇到过这个问题吗?

最佳答案

看起来 git-credential-osxkeychain helper 应用程序在 macOS sierra 上损坏了,将不再检索通过 security find-identities 返回的用户证书

我找到的唯一解决方法是

  • 将钥匙串(keychain)中的证书和 key 导出到 my_certificate.p12
  • 为受影响的帐户编辑 .git/config 以供使用

    [http]
      sslCert = /Users/foo/certificates/my_certificate.p12
      sslcertpasswordprotected = true
    

注意:您需要在 P12 上输入密码,并且每次执行 git 命令时都必须输入 p12 的密码。

附:雷达://28461462

关于更新到 macOS Sierra 后,git 无法在钥匙串(keychain)中找到证书,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39632448/

相关文章:

git - 在 Gerrit 中,修改其他作者推送的提交

svn - Git 强制完全同步到 master

ssl - 为 SSLVerifyClient 要求异常(exception)

php - 无法连接到 SMTP 服务器。在 CakePHP 中

html - 如何为 Safari 14 创建网站图标?

ssl - 为什么为 TLS 到期选择 398 天?

git - 列出 git 标签名称、日期和消息

git - 拒绝 git push

.net - Mono真的跨平台吗?

swift - 当 AVAudioPlayer URL 为 nil 时停止崩溃?