簡體   English   中英

更新到macOS Sierra后,git無法在鑰匙串中找到證書

[英]git unable to find certificate in keychain after updating to 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.

證書在鑰匙串中,並且名稱是正確的(它在更新之前有效),但不知何故我無法訪問它。

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

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

到目前為止還有其他人遇到過這個問題嗎?

看起來git-credential-osxkeychain幫助應用程序在macOS sierra上被破壞,並且不會再檢索帶有安全查找標識的用戶證書

我找到的唯一解決方法是

  • 將證書和密鑰從鑰匙串導出到my_certificate.p12
  • 編輯.git / config以使用受影響的帳戶

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

注意:您需要在P12上輸入密碼,並且每次執行git命令時都必須輸入p12的密碼。

PS:RADAR:// 28461462

如果要使用crt和密鑰文件

[http]
    sslVerify = false
    sslCert = my.crt
    sslKey = my.key

你需要使用openssl支持安裝curl和git

brew install openssl
brew install curl --with-openssl
brew install git --with-brewed-openssl --with-brewed-curl

這對我來說符合預期

簡單的ssh-add幫助了我;)

ssh-add ~/.ssh/id_rsa

首先你必須卸載

brew uninstall openssl
brew uninstall curl
brew uninstall git 

安裝后如@trollr提到的那樣

brew install openssl
brew install curl --with-openssl
brew install git --with-brewed-openssl --with-brewed-curl

,你還必須確保正確的git版本(有MAAAAAANY可用,請參閱

find / -name git

例如,Homebrew告訴你新推出的git版本在哪里

/usr/local/Cellar/git/2.10.2/bin/git

檢查你的版本與哪個git

或者只是調用絕對路徑以確保使用正確的版本,例如

/usr/local/Cellar/git/2.10.2/bin/git clone .......

這對我有用

git -c http.sslCert=/Users/user/Documents/gittest/cert.p12 -c http.sslcertpasswordprotected=true clone https://gitlab.domain.com/user/repository.git

您可以通過添加添加更詳細的調試程序

GIT_CURL_VERBOSE=1 GIT_TRACE=2 GIT_TRACE_PACKET=2 

在命令面前。

證書位於鑰匙串中並標記為受信任。 還存在CA證書。

在將證書名稱更改為不包含除拉丁字母之外的其他字符的字符串之后,我已經解決了與“無法找到證書...”錯誤消息相同的問題。 即將“my_cert.p12”重命名為“mysert.p12”確實有助於消除此錯誤。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM