2013-09-25 117 views
12

當我嘗試$ brew update,我發現了錯誤:如何在libcurl中啓用https支持?

error: Protocol https not supported or disabled in libcurl while accessing https://github.com/mxcl/homebrew/info/refs?service=git-upload-pack 

然而,當我$ curl --version,我看到:

curl 7.21.4 (x86_64-apple-darwin12.2.0) libcurl/7.21.4 OpenSSL/0.9.8y zlib/1.2.5 libidn/1.20 
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smtp smtps telnet tftp 
Features: IDN IPv6 Largefile NTLM SSL libz 

除非我失去了一些東西,這對我來說很好。請注意,協議列表中列出了https

$ which curl產生一個可疑響應:

/usr/local/php5/bin/curl 

Hmmmmm ...也許brew使用不同curl(如一個在/usr/bin/curl)。讓我們來看看:

$ /usr/bin/curl --version

curl 7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8y zlib/1.2.5 
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smtp smtps telnet tftp 
Features: AsynchDNS GSS-Negotiate IPv6 Largefile NTLM NTLM_WB SSL libz 

好吧,這顯然是一個不同的安裝的curl,但它也是在協議列表列出https,並有OpenSSL的信息也有。

順便說一句:如果我嘗試在我的機器上使用https URL與任何git回購,我會得到相同的錯誤。

問題:

  1. 如何確定的路徑curlbrew使用?
  2. 如何在libcurl中啓用對https的支持?

UPDATE:我能夠確定libcurl.4.dylib的路徑git(和brew)由以下以下deltheil的方法,使用。路徑是:

/usr/lib/libcurl.4.dylib (compatibility version 6.0.0, current version 6.1.0) 

所以,我想這一點:

$ brew install curl --with-libssh2 

幸運的是捲曲可在非SSL URI,所以它實際上沒有insstall。它沒有符號鏈接到/usr/local,但這對我來說很好(我認爲)。所以我這樣做:

$ cd /usr/lib 
$ mv libcurl.4.dylib libcurl.4.dylib.bk 
$ ln -s /usr/local/Cellar/curl/7.30.0/lib/libcurl.4.dylib libcurl.4.dylib 
$ brew update 

但它仍然拋出我這個錯誤:

error: Protocol https not supported or disabled in libcurl while accessing https://github.com/mxcl/homebrew/info/refs?service=git-upload-pack 

所以,現在的問題變成獨家:如何啓用對libcurlhttps支持?

回答

4

How can I determine the path to the curl that brew is using?

家釀使用/usr/bin/curl,即附帶的Mac OS X,你可以看到here版本。

這就是說,而且正如你所說的,你的問題可能與與git連接並用於http://https://的libcurl的版本有關。

執行which git以確定您正在使用的版本(我的安裝在/usr/local下)。

然後掃描作爲後續共享庫:

$ otool -L /usr/local/git/libexec/git-core/git-http-push | grep curl 
/usr/lib/libcurl.4.dylib 

替換/usr/local/與對應於你git安裝目錄。

由於您的git exec使用的libcurl版本缺少HTTPS支持,因此它會告訴您此版本及其安裝位置。

+0

感謝@deltheil,你有我一半。我已經用當前的進度更新了這個問題。 –

+0

因爲'git'正確鏈接到系統libcurl,它支持https,所以肯定有什麼問題。這就是說,你應該永遠**,永遠**修改你的系統文件在'/ usr/bin'下,'/ usr/lib'等等。我建議你運行一個'brew doctor'並檢查這個[Github HTTPS克隆錯誤](https://help.github.com/articles/https-cloning-errors)頁面。 – deltheil

+0

或者你可能想通過Homebrew通過'with-brewed-curl'選項來正確安裝'git',這樣'git'就可以使用brew中的'curl',這取決於'darwinssl'的SSL支持。 – deltheil

0

我在OSX上遇到了這個問題。這個問題是在usr/local/bin中重複curl和curl.config文件,它們與usr/bin中的相同兩個文件發生衝突。我刪除了本地/ bin中的第一個集合,然後終端工作。

1

這爲我工作:當你運行命令「捲曲--version」你會

$ ./configure --with-darwinssl  
$ make  
$ make test  
$ sudo make install 

重新安裝捲曲並使用以下命令安裝它(開封后)請注意,https協議現在位於「協議」下。

有用的網站是指當你進入捲曲問題:https://curl.haxx.se/docs/install.html