git clone失败:Cloning into... fatal: unable to access... error setting certificate verify locations
ErrorsCloning 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解
文章共1,055字 · 阅读需要大约4分钟
一键AI生成摘要,助你高效阅读
问答
·
参考链接: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
若要永久生效,在环境变量中进行设置,然后重启终端即可。
更多推荐
已为社区贡献1条内容
所有评论(0)