我通过命令使用Repo脚本:
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo但在那之后,我得到了一个错误:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed我阅读了一些解决这个问题的解决方案,并添加了以下一行:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);但是我想知道哪个是文件,我可以添加这一行吗?请帮帮我!提前感谢!
发布于 2014-11-26 10:18:23
在进行cURL调用时,您将在PHP文件中添加VERIFYPEER。
<?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将无法工作,因此需要使用-不安全的
curl --insecure https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo一个更好的解决方案是尝试并确保安装了SSL证书包。例如在CentOS上:
yum install ca-certificates如果这不起作用,您可以从http://curl.haxx.se/ca/cacert.pem或https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt下载并手动包含该包
curl_setopt($ch, CURLOPT_CAPATH, 'ca-bundle.crt');或通过命令行
curl --cacert /path/to/ca-bundle.crt https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo发布于 2014-11-26 10:13:31
您可以在--不安全选项中使用curl shell命令:
curl --insecure https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo在“卷曲手册”页面中:
-k/--insecure
(SSL) This option explicitly allows curl to perform "insecure"
SSL connections and transfers. [...]发布于 2015-05-25 02:01:05
也许您与git服务器的网络连接被阻止了!
https://stackoverflow.com/questions/27146192
复制相似问题