git 如何在 libcurl 中启用 https 支持?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19015282/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I enable https support in libcurl?
提问by Ben Harold
When I try to $ brew update
I'm getting the error:
当我尝试时,$ brew update
我收到错误:
error: Protocol https not supported or disabled in libcurl while accessing https://github.com/mxcl/homebrew/info/refs?service=git-upload-pack
However, when I $ curl --version
, I see:
但是,当$ 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
Unless I'm missing something, that looks good to me. Notice that https
is listed in the protocols list.
除非我遗漏了什么,否则对我来说看起来不错。请注意,https
在协议列表中列出。
$ which curl
yields a suspicious response:
$ which curl
产生一个可疑的响应:
/usr/local/php5/bin/curl
Hmmmmm...maybe brew
is using a different curl
(like the one at /usr/bin/curl
). Let's see:
嗯……也许brew
正在使用不同的curl
(如/usr/bin/curl
)。让我们来看看:
$ /usr/bin/curl --version
$ /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
Okay, it's obviously a different install of curl
, but it's also listing https
in the protocols list, and has the OpenSSL info there too.
好的,这显然是 的不同安装curl
,但它也在https
协议列表中列出,并且那里也有 OpenSSL 信息。
BTW: I get the same error if I try to use an https
URL with any git
repo on my machine.
顺便说一句:如果我尝试在我的机器上使用https
带有任何git
repo的URL,我会遇到同样的错误。
Questions:
问题:
How can I determine the path to thecurl
thatbrew
is using?- How do I enable support for
https
inlibcurl
?
我怎么能确定的路径,curl
即brew
使用?- 如何启用对
https
in 的支持libcurl
?
UPDATE:I was able to determine the path to libcurl.4.dylib
that git
(and brew
) are using by following deltheil's method below. The path is:
更新:我能够确定的路径,libcurl.4.dylib
即git
(并brew
按照以下deltheil法)使用。路径是:
/usr/lib/libcurl.4.dylib (compatibility version 6.0.0, current version 6.1.0)
So I tried this:
所以我试过这个:
$ brew install curl --with-libssh2
Luckily curl is available at a non-SSL URI, so it actually did insstall. It didn't symlink into /usr/local
, but that's fine with me (I think). So I did this:
幸运的是 curl 在非 SSL URI 上可用,所以它确实安装了。它没有符号链接到/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
But it's still throwing me this error:
但它仍然给我这个错误:
error: Protocol https not supported or disabled in libcurl while accessing https://github.com/mxcl/homebrew/info/refs?service=git-upload-pack
So now the question exclusively becomes: How do I enable support for https
in libcurl
?
所以现在问题变成了:如何启用对https
in 的支持libcurl
?
采纳答案by deltheil
How can I determine the path to the curl that brew is using?
如何确定 brew 使用的卷曲路径?
Homebrew uses /usr/bin/curl
, i.e the version that ships with Mac OS X, as you can see here.
Homebrew 使用/usr/bin/curl
,即 Mac OS X 附带的版本,您可以在此处看到。
That being said, and as you precise, your problem is probably related to the version of libcurl that is linked with git
and used for http://
and https://
.
话虽如此,正如您所说,您的问题可能与与git
and链接并用于http://
and的 libcurl 版本有关https://
。
Perform a which git
to determine which is the version you are being used (mine is installed under /usr/local
).
执行 awhich git
以确定您正在使用的版本(我的安装在 下/usr/local
)。
Then scan the shared libraries used as follow:
然后扫描使用的共享库如下:
$ otool -L /usr/local/git/libexec/git-core/git-http-push | grep curl
/usr/lib/libcurl.4.dylib
Replace /usr/local/
with the install directory that corresponds to your git
.
替换为/usr/local/
与您的git
.
Since the libcurl version used by your git
exec lacks of HTTPS support, this will tell you what is this version and where it is installed.
由于您的git
exec使用的 libcurl 版本缺乏 HTTPS 支持,这将告诉您这个版本是什么以及它安装在哪里。
回答by Divij Ohri
This worked for me:
这对我有用:
Re-install curl and install it using the following commands (after unpacked):
重新安装 curl 并使用以下命令进行安装(解压后):
$ ./configure --with-darwinssl
$ make
$ make test
$ sudo make install
When you run the command "curl --version" you'll notice that the https protocol is now present under "protocols".
当您运行命令“curl --version”时,您会注意到 https 协议现在出现在“protocols”下。
Useful site to refer when you run into curl problems: https://curl.haxx.se/docs/install.html
遇到 curl 问题时可以参考的有用站点:https: //curl.haxx.se/docs/install.html
回答by jsanabria
I had this issue on OSX. The issue were duplicate curl and curl.config files inside usr/local/bin that conflicted the same two files in usr/bin. I deleted the first set in the local/bin and Terminal worked after that.
我在 OSX 上遇到了这个问题。问题是 usr/local/bin 中重复的 curl 和 curl.config 文件与 usr/bin 中的两个文件冲突。我删除了本地/bin 中的第一组,然后终端工作。