2013-12-22 16 views
4

無法使用git製作混帳恢復的SSLv3時的TLSv1失敗 「忽略未知記錄」

git clone https://github.com/foo/bar 

失敗:

fatal: unable to access 'https://github.com/foo/bar': Unknown SSL protocol error in connection to github.com:443 

我怎麼能強迫git使用的SSLv3?我試圖從源代碼編譯git,但沒有超出以下設置:--with-openssl(默認)。在remote-curl.c添加下面的一行行408之前,無法正常工作或:

curl_easy_setopt(slot->curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_SSLv3); 

這裏有一些線索:

  • 情況1:當我的瀏覽器嘗試去https://github.com/foo/bar,它首先嚐試TLSv1。握手似乎是好的:服務器密鑰交換,服務器問候(在Wireshark)。但接下來是服務器的「忽略未知記錄」,最後是服務器的「連接重置」。然後,一個新的連接,但SSLv3踢,每一件事情都很好(見picture)。

  • 殼體2curl失敗使用的TLSv1

    curl https://github.com/foo/bar 
    

    失敗:

    curl: (35) Unknown SSL protocol error in connection to github.com:443 
    

    設置--sslv3修復該問題。

  • 殼體3:取這一個

    sudo add-apt-repository ppa:cassou/emacs 
    

    失敗:

    pycurl.error: (35, 'gnutls_handshake() failed: A TLS packet with unexpected length was received.') 
    

編輯:捲曲7.22.0(i686的-PC-Linux的GNU)的libcurl /7.22.0 OpenSSL/1.0.1。

編輯:調試信息

Cloning into 'bar'... 
* Couldn't find host github.com in the .netrc file; using defaults 
* About to connect() to github.com port 443 (#0) 
* Trying 192.30.252.130... * Connected to github.com (192.30.252.130) port 443 (#0) 
* successfully set certificate verify locations: 
* CAfile: none 
    CApath: /etc/ssl/certs 
* Unknown SSL protocol error in connection to github.com:443 
* Closing connection #0 
fatal: unable to access 'https://github.com/foo/bar/': Unknown SSL  protocol error in connection to github.com:443 
+1

你使用的是什麼版本的Git?什麼版本的捲曲?什麼OS? Linux呢?視窗? Cygwin的? – VonC

+0

請使用'GIT_CURL_VERBOSE = 1'添加調試信息。 –

+0

我從github下載了git源代碼。 curl 7.22.0(i686-pc-linux-gnu)libcurl/7.22.0 OpenSSL/1.0.1。 – Yasser

回答

4

更新2015年8月:混帳2.6+(Q3 2015)將允許明確指定的SSL版本:

http:添加用於指定支持SSL版本

請參閱commit 01861cb(2015年8月14日)作者Elia Pinto (devzero2000)
已幫助:Eric Sunshine (sunshineco)。協商的SSL連接時,如果要強制默認
(由Junio C Hamano -- gitster --commit ed070a4合併,2015年8月26日)

http.sslVersion 

的SSL版本使用。
可用和默認版本取決於libcurl是針對NSS還是OpenSSL構建的,以及正在使用的加密庫的特定配置。在內部,這設置'CURLOPT_SSL_VERSION'選項;請參閱libcurl文檔以獲取有關此選項格式和支持的ssl版本的更多詳細信息。
其實這個選項的可能值是:

  • SSLV2
  • SSLV3
  • 的TLSv1
  • tlsv1.0
  • tlsv1.1
  • TLSv1.2工作

可以被'GIT_SSL_VERSION'環境覆蓋t變量。
要強制git使用libcurl的默認ssl版本並忽略任何明確的http.sslversion選項,請將'GIT_SSL_VERSION'設置爲空字符串。


原來的答覆12月:2013

我平時看的時候我的代理環境變量設置不正確的錯誤消息:

export HTTP_PROXY=http://user:[email protected]:port 
export HTTPS_PROXY=http://user:[email protected]:port 
export NO_PROXY=.mycompany.com 

您還可以setup a ~/.netrc file您GitHub的憑據。

確保您git config http.sslcainfo並引用您的/path/to/git/bin/curl-ca-bundle.crt,爲了使捲曲能夠驗證關聯到GitHub的服務器證書。


一個解決辦法,如果真的HTTPS不起作用,是使用SSH URL

git clone ssh://[email protected]:project.git 

(如果你已經產生了私鑰和公鑰第一,並註冊該公鑰到您的GitHub賬號)

+0

謝謝。該解決方法奏效。但是我遇到了與「bower install jquery」相同的問題:重試請求https://bower.herokuapp.com/packages/jquery失敗,並且ECONNRESET失敗。 (這張照片實際上來自這個命令,而不是git)。我可以在沒有代理的情況下使用SSLv3訪問該鏈接。 – Yasser

+1

@YasserMZadeh很奇怪。我通過https://github.com/bower/bower/issues/631看到了這一點,與網絡問題有關。 – VonC