首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SL3_GET_SERVER_CERTIFICATE:certificate验证失败

SL3_GET_SERVER_CERTIFICATE:certificate验证失败
EN

Stack Overflow用户
提问于 2014-11-26 10:03:03
回答 3查看 491关注 0票数 0

我通过命令使用Repo脚本:

代码语言:javascript
复制
 curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo

但在那之后,我得到了一个错误:

代码语言:javascript
复制
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

我阅读了一些解决这个问题的解决方案,并添加了以下一行:

代码语言:javascript
复制
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

但是我想知道哪个是文件,我可以添加这一行吗?请帮帮我!提前感谢!

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2014-11-26 10:18:23

在进行cURL调用时,您将在PHP文件中添加VERIFYPEER。

代码语言:javascript
复制
<?php 
// create curl resource 
$ch = curl_init(); 

// set url 
curl_setopt($ch, CURLOPT_URL, "example.com"); 

//return the transfer as a string 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 

// set verifypeer to false
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

// $output contains the output string 
$output = curl_exec($ch); 

// close curl resource to free up system resources 
curl_close($ch);      
?>

在命令行运行curl时,verifypeer将无法工作,因此需要使用-不安全的

代码语言:javascript
复制
curl --insecure https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo

一个更好的解决方案是尝试并确保安装了SSL证书包。例如在CentOS上:

代码语言:javascript
复制
yum install ca-certificates

如果这不起作用,您可以从http://curl.haxx.se/ca/cacert.pemhttps://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt下载并手动包含该包

代码语言:javascript
复制
curl_setopt($ch, CURLOPT_CAPATH, 'ca-bundle.crt');

或通过命令行

代码语言:javascript
复制
curl --cacert /path/to/ca-bundle.crt https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
票数 0
EN

Stack Overflow用户

发布于 2014-11-26 10:13:31

您可以在--不安全选项中使用curl shell命令:

代码语言:javascript
复制
curl --insecure https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo

在“卷曲手册”页面中:

代码语言:javascript
复制
-k/--insecure
              (SSL)  This  option explicitly allows curl to perform "insecure"
              SSL connections and transfers. [...]
票数 0
EN

Stack Overflow用户

发布于 2015-05-25 02:01:05

也许您与git服务器的网络连接被阻止了!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27146192

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档