git clone失败:Cloning into... fatal: unable to access... error setting certificate verify locations

参考链接:others-How to solve ‘gnutls_handshake() failed’ error when doing ‘git clone’ from github.com ?

Errors

在这里插入图片描述

Cloning into 'GlobalTrack'...
fatal: unable to access 'https://github.com/xxx.git/': 
error setting certificate verify locations:
CAfile: E:/dev/env/Git/mingw64/ssl/certs/ca-bundle.crt CApath: none

Solution #1(如果不行,直接看解决方案3,最后再考虑解决方案2)

前提,网络连接良好!

ping www.bing.com

PING china.bing123.com (202.89.233.100) 56(84) bytes of data.
64 bytes from 202.89.233.100 (202.89.233.100): icmp_seq=1 ttl=118 time=30.1 ms
64 bytes from 202.89.233.100 (202.89.233.100): icmp_seq=2 ttl=118 time=29.4 ms
64 bytes from 202.89.233.100 (202.89.233.100): icmp_seq=3 ttl=118 time=30.2 ms
^C
--- china.bing123.com ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5007ms
rtt min/avg/max/mdev = 29.437/29.986/30.198/0.259 ms

https 修改为 http

# git clone https://github.com/MasterBin-IIAU/Unicorn.git unicorn
git clone http://github.com/MasterBin-IIAU/Unicorn.git unicorn

Solution #2(暴力解决,不推荐使用)

git config --global http.sslverify "false"

Solution #3(指定证书的路径,推荐使用)

# 如果报 fatal: not in a git directory, 先执行 git init 命令
# git init
sudo git config --system http.sslCAinfo /etc/ssl/certs/ca-certificates.crt

注意:针对 Solution #2/3,如果修改之后仍然无法生效,kill 当前终端,重新打开一个运行 git clone,基本上就没有任何问题了!

写在最后

测试终端是否可以 使用魔法,

curl -vvvk https://www.google.com --connect-timeout 6

Linux 终端设置代理

export http_proxy=http://127.0.0.1:7890
export https_proxy=http://127.0.0.1:7890

Windows 终端代理设置

  • PowerShell
# 一般指设置 第二个 HTTPS_PROXY 即可
# 10809 改为你的代理软件的 http 端口
# Clash for Windows 一般为 7890,v2rayN 为 10809(socks+1)
$ENV:HTTP_PROXY = "http://127.0.0.1:10809"
$ENV:HTTPS_PROXY = "http://127.0.0.1:10809"
  • cmd
# 临时生效
set http_proxy=http://127.0.0.1:10809
set https_proxy=http://127.0.0.1:10809

若要永久生效,在环境变量中进行设置,然后重启终端即可。
在这里插入图片描述

  • 10
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
根据引用\[1\]和引用\[3\]的内容,当执行"git clone"命令时,可能会出现连接失败的错误。这个错误通常是由于git无法使用SSL进行连接所导致的。解决这个问题的方法是使用libcurl4-gnutls-dev替换gnutls对git进行编译。以下是解决方法的具体步骤: 1. 打开终端,并在根目录下执行以下命令更新软件包列表: ``` sudo apt-get update ``` 2. 安装必要的软件包和依赖项: ``` sudo apt-get install build-essential fakeroot dpkg-dev libcurl4-openssl-dev ``` 3. 使用libcurl4-gnutls-dev替换gnutls对git进行编译: ``` mkdir ~/git-openssl cd ~/git-openssl apt-get source git ``` 4. 进入git源码目录: ``` cd git-2.17.1/ #实际版本可能不同 ``` 5. 编译和安装git: ``` sudo make sudo make install ``` 通过以上步骤,你应该能够成功解决git clone https://github.com/ros/catkin.git失败的问题。请注意,实际的git版本和目录可能会有所不同,所以请根据你的实际情况进行相应的调整。 #### 引用[.reference_title] - *1* *3* [git clone fatal: unable to access ‘https://github.com/robopeak/rplidar_ros.git/](https://blog.csdn.net/m0_53294928/article/details/122736258)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [Ubuntu18.04 编译 ORB-SLAM2(./build.sh + ./build_ros.sh)完整流程,各种报错处理(踩坑总结)](https://blog.csdn.net/m0_60355964/article/details/124065545)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值