一、問題描述
早上在學習《Spark快速大數據分析》的時候,需要下載書本的實例代碼,於是用git clone一下給出的庫:
https://github.com/databricks/learning-spark.git
結果,並不能成功克隆,最后的錯誤輸出信息是“git https fatal: HTTP request failed”。
二、解決過程
上網找了一下,一種方案是用git:或者ssh:代替https:,譬如github官網給出的方案:https://help.github.com/articles/using-ssh-over-the-https-port/,按照這個去做而且成功了,然而並沒什么卵用,出現了“Error: Permission denied (publickey)”,還是無法克隆。且罷。
於是還是繼續用https鏈接,了解到原來git使用curl作為它的https傳輸客戶端,需要設置一個環境變量:
export GIT_CURL_VERBOSE=1
https://github.com/databricks/learning-spark.git
還是有報錯,首先是ping不通github.com,上網搜了一下可以設置為另一個地址:192.30.253.113,可以ping通,於是在/etc/hosts文件加上:
192.30.253.113 github.com
還有就是證書問題,設置一下:
git config --global http.sslverify true git config --global http.sslCAPath /etc/pki/tls/certs
重新操作還是報錯,這次是“failed to load from … CURLOPT_CAPATH”以及“NSS error -12286”,猜測是curl的配置問題。
最后通過一篇文章了解到應該是cipher的問題,https://bugs.centos.org/view.php?id=5620,其中有評論說到:
Yes there is and this is not a bug, it's just that in the latest version curl doesn't have RC4-SHA enabled by defaul.
按照里面說的方法測試了一下:
curl --cipher rsa_rc4_128_sha https://github.com/databricks/learning-spark.git
然后。。。表示沒有這種cipher,最后提示“curl: (35) SSL connect error”,通過這個信息,找到另外一篇博文,說需要先升級nss:
yum update nss
升級完之后,重新克隆目標庫,終於搞定!!!
三、參考
1. git and HTTPS (fatal: HTTP request failed)
2. Using SSH over the HTTPS port
3. curl: (35) SSL connect error的解決方法
(完)