git clone拉取GitHub项目失败/太慢的解决方法 and bug解决: The TLS connection was non-properly terminated
git clone拉取GitHub项目失败/太慢的解决方法andbug解决: The TLS connection was non-properly terminated
解决方法:
确定是否安装git工具包
通过在终端输入以下命令可以查看:
git --version
如果没有安装,可以通过以下命令进行安装:
sudo apt install git
拉取失败/慢的原因与解决方法
如果已安装git工具包,但是下载失败,可能是以下原因导致
- 挂了梯子等原因,需要关掉VPN后进行在进行拉取;
- git版本过低,通过以下命令更新git
sudo apt-get upgrade
sudo apt install git
网不好/源不好/地址偏等等
- 使用国内GitHub镜像站(不一定很快,但有用)镜像站是对原有网站内容的拷贝,与原有网站数据存放在不同的服务器上,可以加快网站的访问或下载速度。以从GitHub上拉取turtlebot3的项目文件为例,命令如下:
git clone https://github.com/ROBOTIS-GIT/turtlebot3_msgs.git
速度可能会很慢,甚至超时导致失败此时可以通过对上述命令进行修改,将其
git clone https://github.com.cnpmjs.org//ROBOTIS-GIT/turtlebot3_msgs.git
换句话说就是将拉取中命令网址前面的 github.com 替换为 github.com.cnpmjs.org
也可以通过此修改访问GitHub中项目对应的网页(推荐使用Google Chrome浏览器)
修改前:
https://github.com/ROBOTIS-GIT/turtlebot3_msgs
修改后:
https://github.com.cnpmjs.org//ROBOTIS-GIT/turtlebot3_msgs
- 另一种方法使用国内GitHub镜像站(很有用,很方便)同上一条,将其替换。换句话说就是将你的拉取中命令网址前面的https://替换为git://
git clone https://github.com/ROBOTIS-GIT/turtlebot3_msgs.git
替换为
git clone git://github.com//ROBOTIS-GIT/turtlebot3_msgs.git
- 直接去GitHub网址下载项目压缩包(附进入网址方法)直接访问项目的GitHub网页,按照下面方法点击下载压缩包再解压:注意:如果进不去GitHub网页,可以通过(3-1)的方法进入
将拉取中命令网址前面的 github.com 替换为 github.com.cnpmjs.org使用修改后的网址进入(使用Google Chrome浏览器)
方法总结
由于网络/墙/地址不稳定等各种各样的原因均可能导致git clone失败
主要原因一般是网络问题,可以通过:
- (1)关闭VPN / 升级git包;
- (2)使用国内的GitHub镜像源下载;
- (3)直接前往网页下载压缩包再解压
自主尝试:
背景:
-
- 系统ubuntu22.04
- 有vpn,开启了vpn,127.0.0.1:7890
错误:
(base) shuangmu@lzx:/media/shuangmu/2T_ntfs1$ git clone https://github.com/opendatalab/MinerU.git
正克隆到 'MinerU'...
fatal: 无法访问 'https://hub.fastgit.org/opendatalab/MinerU.git/':gnutls_handshake() failed: The TLS connection was non-properly terminated.
错误原因:权限不足?
The TLS connection was non-properly terminated.:
解决办法:前面加上sudo -> 解决成功
sudo git clone https://github.com/opendatalab/MinerU.gi
办法2:
git config --global --unset http.proxy
git config --global --unset https.proxy
实际原因是: git也要配置网络代理,而我使用了clash ,代理就出问题了。
git config --global http.proxy 'socks5://127.0.0.1:7890'
git config --global https.proxy 'socks5://127.0.0.1:7890'
git config --global http.proxy 'http://127.0.0.1:7890'
git config --global https.proxy 'http://127.0.0.1:7890'
一些代理相关命令:
#查看代理
git config --global http.proxy
#删除代理
git config --global --unset http.proxy
git config --global --unset https.proxy
取消curl代理
unset http_proxy
unset https_proxy
如果curl也需要设置代理,配置文件~/.curlrc
proxy = server1.cyberciti.biz:3128
proxy-user = “foo:bar”
如我使用下面的内容就可以和 git的http代理统一起来了
proxy = http://127.0.0.1:45077
参考文章:
更多推荐
所有评论(0)