当我尝试 $ brew update
时出现错误:
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
列在协议(protocol)列表中。
$ 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
的不同安装,但它还在协议(protocol)列表中列出了 https
,并且那里也有 OpenSSL 信息。
顺便说一句:如果我尝试将 https
URL 与我机器上的任何 git
存储库一起使用,我会遇到同样的错误。
问题:
如何确定brew
正在使用的curl
的路径?- 如何在
libcurl
中启用对https
的支持?
更新:我能够确定 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
幸运的是,curl 在非 SSL URI 上可用,所以它确实安装了。它没有符号链接(symbolic link)到 /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
所以现在问题完全变成了:如何在 libcurl
中启用对 https
的支持?
最佳答案
How can I determine the path to the curl that brew is using?
Homebrew 使用 /usr/bin/curl
,即 Mac OS X 附带的版本,如您所见here .
话虽这么说,正如您所说,您的问题可能与与 git
链接并用于 http://
和 https://
.
执行 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 支持,这将告诉您这个版本是什么以及它的安装位置。
关于git - 如何在 libcurl 中启用 https 支持?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19015282/