gitlab同步代码时https证书错误

OS:Ubuntu 14.04

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

curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: http://curl.haxx.se/docs/sslcerts.html

curl 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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值