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

jon*_*und 9 git macos ssl macos-sierra

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

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

fatal: unable to access 'https://....': SSL: Can't find the certificate "...." and its private key in the Keychain.
Run Code Online (Sandbox Code Playgroud)

证书在钥匙串中,并且名称是正确的(它在更新之前有效),但不知何故我无法访问它.

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

[http "https://...."]
    sslCert = ....
[credential]
    helper = osxkeychain
Run Code Online (Sandbox Code Playgroud)

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

小智 6

看起来git-credential-osxkeychain帮助应用程序在macOS sierra上被破坏,并且不会再检索带有安全查找标识的用户证书

我找到的唯一解决方法是

  • 将证书和密钥从钥匙串导出到my_certificate.p12
  • 编辑.git/config以使用受影响的帐户

    [http]
      sslCert = /Users/foo/certificates/my_certificate.p12
      sslcertpasswordprotected = true
    
    Run Code Online (Sandbox Code Playgroud)

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

PS:RADAR:// 28461462