电脑不知道为什么不能git clone,报错:

$ git clone https://github.com/ShixiangWang/VSHunter
正克隆到 'VSHunter'...
fatal: unable to access 'https://github.com/ShixiangWang/VSHunter/': gnutls_handshake() failed: The TLS connection was non-properly terminated.

查了下需要使用libcurl4-openssl-dev替换gnutls对git进行编译。

sudo apt-get install build-essential fakeroot dpkg-dev
mkdir ~/git-openssl
cd ~/git-openssl
sudo apt-get source git
sudo apt-get build-dep git

如果出现找不到源代码的报错,使用命令sudo vim /etc/apt/sources.list打开文件并取消带deb_src那一行的注释,保存后运行sudo apt update,然后再执行上面最后一条命令
接着:

sudo apt-get install libcurl4-openssl-dev
sudo dpkg-source -x git_2.17.0-1.dsc
cd git_2.17.0 #实际版本可能不同

然后编辑文件debian/control,使用命令sudo vim deebian/control,将全部的libcurl4-gnutls-dev改为libcurl4-openssl-dev 。
接着运行命令:

sudo dpkg-buildpackage -rfakeroot -b
# (if it's failing on test, you can remove the line TEST=test from the file debian/rules)
sudo  dpkg -i  ../git_2.17.0-1_amd64.deb 

一般情况下到这就修复了这个问题了,但此时我还是不能进行克隆。

$ git clone https://github.com/ShixiangWang/VSHunter.git
正克隆到 'VSHunter'...
fatal: unable to access 'https://github.com/ShixiangWang/VSHunter.git/': OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to 127.0.0.1:45077

通过搜索,我搞明白 git也要配置网络代理,而我使用了蓝灯,代理就出问题了。
进行以下配置:

git config --global http.proxy 'socks5://127.0.0.1:45077'
git config --global https.proxy 'socks5://127.0.0.1:45077'
git config --global http.proxy 'http://127.0.0.1:45077'
git config --global https.proxy 'http://127.0.0.1:45077'

注意端口号也设置代理的端口号,不同vpn,不同系统端口号可能不同。

现在我就能够正常克隆了:

$ git clone https://github.com/ShixiangWang/VSHunter.git
正克隆到 'VSHunter'...
remote: Enumerating objects: 95, done.
remote: Counting objects: 100% (95/95), done.
remote: Compressing objects: 100% (57/57), done.
remote: Total 591 (delta 54), reused 64 (delta 34), pack-reused 496
接收对象中: 100% (591/591), 149.13 MiB | 848.00 KiB/s, 完成.
处理 delta 中: 100% (361/361), 完成.

一些代理相关命令:
#查看代理
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

参考文章:

解决git gnutls_handshake失败
github 遇到 OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443问题

作者:王诗翔
链接:https://www.jianshu.com/p/72b9903a05f4
来源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

git报错 failed: The TLS connection was non-properly terminated相关推荐

  1. k8s ceph csi创建pvc报错 failed to get connection: connecting failed: rados: ret=13, Permission denied

    起因 在使用k8s对接ceph-csi时,按照ceph官方流程部署完毕后,在执行kubectl apply -f pvc.yaml 时,相关pod一直处于pending状态. 使用命令kubectl ...

  2. MySQL报错 Failed to validate connection com.mysql.cj.jdbc.ConnectionImpl

    报错:springboot 项目向 MySQL 请求SqlSession时报错 Creating a new SqlSession SqlSession [org.apache.ibatis.sess ...

  3. idea提交git报错Failed with error: Authentication failed for ‘http://gitlab.

    1.git报这个错误fatal: Authentication failed for 解决办法: git config --system --unset credential.helper 1 之后你 ...

  4. jenkins配置git报错 failed to connect to repositary

    解决办法:配置github/gitlab的SSH keys 1.在电脑目录下C:\Users\username\.ssh找到id_rsa.pub文件,将其中内容复制 如果没有该文件,则登录github ...

  5. fatal: 无法访问 ‘x.git/‘gnutls_handshake() failed: The TLS connection was non-properly terminated.解决办法

    我在服务器上克隆代码时报错: #git clone --recursive https://github.com/stevenlovegrove/Pangolin.git 正克隆到 'Pangolin ...

  6. Git报错: OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443

    Git报错: OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443 在使用Git来克隆仓库报了错误,如下: fa ...

  7. git报错 git libpng warning: iCCP以及fatal: Authentication failed for ‘https://git.weixin.qq.com‘

    git打卡,本来是老哥带着我做项目,纯git新手小白,以后出现问题自己解决了,顺便分享一下自己的经验,防止以后忘记,顺便给新人铺个路~ 我一开始在使用git clone的时候,一共出现了两个错误,到处 ...

  8. jenkins构建时git报错:hudson.plugins.git.GitException: Failed to fetch from

    问题: jenkins拉取远程代码构建git报错:hudson.plugins.git.GitException: Failed to fetch from 拉不到远程分支 提示信息如下 ERROR: ...

  9. Git报错:fatal: Authentication failed for ‘https://gitee.com/.......‘

    提交代码到码云,Git报错如下: Gavin: Incorrect username or password (access token) fatal: Authentication failed f ...

最新文章

  1. 通过Excel生成批量SQL语句
  2. R语言统计代码运行耗时实战:计算代码运行时间、使用proc.time函数计算代码运行时间
  3. 【运筹学】线性规划数学模型 ( 单纯形法原理 | 单纯形法流程 | 查找初始基可行解 )
  4. 【预告】新房装修网络规划网络布局学习笔记,家庭网络需求文章内容及结构...
  5. MySQL————表维护相关低频操作总结
  6. python获取对象的大小_Python实现计算对象的内存大小示例
  7. Oracle(一):简介、安装、DDL、DML、JDBC、导入导出
  8. thinkphp 路由
  9. python3.6---之f'{}'
  10. 让django完成翻译,迁移数据库模型
  11. 用迅雷打开php文件,迅雷下的php文件怎么打开啊?
  12. 计算机的数学知识的手抄报图片大全,【数学小报图片大全】数学小报简单又漂亮_简单数学小报图片大全_亲亲宝贝网...
  13. OpenCV局部阙值分割的自适应阙值算法
  14. linux 配置主机名
  15. ARFoundation
  16. EXCEL2021 网站复制内容突然粘贴不了到单元格
  17. 我们使用的人工智能产品,大致分为六类,掌握以下几个名词,以备不时之需
  18. 广告点击率预测(kaggle)
  19. 菜鸟学数电1-如何看懂TTL名称
  20. 苹果手机最新款什么时候上市_疫情期间价格上涨,二手苹果手机最佳购入时期是什么时候?...

热门文章

  1. 通过LR给随手拍的静物照片进行小清新色调的调色
  2. 3分钟短文:Laravel路子真野啊!路由昵称前缀中间件
  3. Python中import的用法总结
  4. 期货市场的投资者适当性原则
  5. 利用python中basemap库绘制地图
  6. TPAMI 2021 | 让时间走向二维,基于文本的视频时间定位新方法:MS-2D-TAN,兼顾速度与精度!...
  7. Maya---物体跟随曲线动画
  8. ROUGE: A Package for Automatic Evaluation of Summaries
  9. 微信小程序vantweapp-Dialog弹出框提交表单,并还原确定按钮样式
  10. 硅谷科技巨头CEO一年赚多少?这10位高薪代表了解一下