git 如何为 api.github 的 cURL 请求启用 https?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23779074/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 10:02:42  来源:igfitidea点击:

How can I enable https for cURL request to api.github?

gitcurlgithubhttpslibcurl

提问by Ronny Springer

I want to search for github repositories (github API v3) by curl request with https at git bash (v1.9.2 on Windows).

我想通过在 git bash 上使用 https 的 curl 请求搜索 github 存储库(github API v3)(Windows 上的 v1.9.2)。

My test request looks like this:

我的测试请求如下所示:

$ curl -H 'Accept: application/vnd.github.v3.text-match+json' \ https://api.github.com/search/repositories?q=jquery/jquery(see API doku)

$ curl -H 'Accept: application/vnd.github.v3.text-match+json' \ https://api.github.com/search/repositories?q=jquery/jquery见 API 独库

I get this response:

我得到这个回应:

curl: (1) Protocol https not supported or disabeld in libcurl

curl: (1) Protocol https not supported or disabeld in libcurl

Can anybody give me an advice for configuration? For addition, it'll be helpful for me to get some technical infos behind. I'm still learning.

有人可以给我一个配置建议吗?此外,了解一些技术信息对我很有帮助。我还在学习。

UPDATE:

更新

I update my Question into "How do I enable https for cURL using GIT Bash (v1.9.2) on Windows and where can I find ./configurefile to add --with-sslattribute?"

我将我的问题更新为“如何在 Windows 上使用 GIT Bash (v1.9.2) 为 cURL 启用 https 以及在哪里可以找到./configure添加--with-ssl属性的文件?”

Best, Ronn

最好的,罗恩

回答by John Szakmeister

curl: (1) Protocol https not supported or disabeld in libcurl

curl: (1) Protocol https not supported or disabeld in libcurl

The error message means that curl was not built with SSL support. If you built curl from source, you'll need to rebuild it with SSL support. For curl, this is done by passing the --with-sslflag to configure:

错误消息意味着 curl 没有使用 SSL 支持构建。如果您从源代码构建 curl,则需要使用 SSL 支持重新构建它。对于 curl,这是通过将--with-ssl标志传递给configure

$ ./configure --with-ssl

Depending on your setup, you may need to take additional steps. The curl install docs do a decent job of explaining the steps: http://curl.haxx.se/docs/install.html

根据您的设置,您可能需要采取额外的步骤。curl 安装文档很好地解释了这些步骤:http: //curl.haxx.se/docs/install.html