git clone server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile

git clone server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile

今天在运行git clone命令时遇到如下错误:

here 看到之前有人遇到过同样的问题,现将解决思路提供如下。

主要的问题是你的linux系统并不信任你所要git的网站,所以通不过系统安全认证。解决方案有两个:第一,告诉系统这个网站是可信任的;第二,关闭系统的安全认证,这个有些极端了。

告诉系统这个网站是可信任的

由于这个方法操作起来比较繁琐,我并没有采用这种方法,但是将这种方法的具体步骤提供给大家。

You need to check the web certificate used for your gitLab server, and add it to your </git_installation_folder>/bin/curl-ca-bundle.crt
To check if at least the clone works without checking said certificate, you can set: 
export GIT_SSL_NO_VERIFY=1 
or 
git config --global http.sslverify false

But that would be for testing only, as illustrated in “SSL works with browser, wget, and curl, but fails with git“, or in this blog post.

Check your GitLab settings, a in issue 4272.

To get that certificate (that you would need to add to your curl-ca-bundle.crt file), type a:

echo -n | openssl s_client -showcerts -connect yourserver.com:YourHttpGilabPort 2>/dev/null  | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'

(with yourserver.com being your GitLab server name)

To check the CA (Certificate Authority issuer), type a:

echo -n | openssl s_client -showcerts -connect yourserver.com:YourHttpGilabPort 2>/dev/null  | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'| openssl x509 -noout -text | grep "CA Issuers" | head -1

to identify the location of curl-ca-bundle.crt, you could use the command

curl-config --ca

关闭系统的安全认证

我使用的是这种简单粗暴的方式,关闭验证。这种方式能在很短时间内收到效果,如果没有耐心进行上面的设置的话,可以采用下面的命令。打开终端,在命令行中输入如下命令即可:

export GIT_SSL_NO_VERIFY=1
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值