gitlab同步代码时https证书错误

来源:互联网 发布:怎么在淘宝买高仿手表 编辑:程序博客网 时间:2024/05/29 12:41

OS:Ubuntu 14.04

最近在用 repo从gitlab上同步代码,执行repo init总是会有报错:

curl: (60) SSL certificate problem: unable to get local issuer certificateMore details here: http://curl.haxx.se/docs/sslcerts.htmlcurl performs SSL certificate verification by default, using a "bundle" of Certificate Authority (CA) public keys (CA certs). If the default bundle file isn't adequate, you can specify an alternate file using the --cacert option.If this HTTPS server uses a certificate signed by a CA represented in the bundle, the certificate verification probably failed due to a problem with the certificate (it might be expired, or the name might not match the domain name in the URL).If you'd like to turn off curl's verification of the certificate, use the -k (or --insecure) option.


搜索了一圈资料,没找到好的解决方法,有一个方法是从http://curl.haxx.se/ca/cacert.pem下载证书,但是并没找到该怎么用这个下载的证书文件。

正在自己挠头的时刻,忽然看到上面日志提到的url:http://curl.haxx.se/docs/sslcerts.html,抱着一试的心态,还真找到了我想要的证书使用方法,真是"众里寻他千百度,蓦然回首,那人却在,灯火阑珊处"。

这个链接里也提到了,证书是作为网站合法性验证的工具,应该是由于我的本地证书不完整,或者是已经过期,无法验证gitlab的合法性,所以需要有一个最新的证书文件。将cacert.pem下载到本地后,只要执行export CURL_CA_BUNDLE={cacert.pem文件路径},此时再去做repo init,就不再报证书的错误了。

repo sync时出现类似于:

curl: (22) The requested URL returned error: 401 Unauthorized
这种401认证错误的问题,也可以用以上的方法解决。


参考:

SSL Certificate Verification

Linux使用curl访问https站点时报错汇总

curl: (60) SSL certificate problem: unable to get local issuer certificate

0 0