Git系列讲解(六):Git使用中的问题汇总

记录一下使用过程中可能会出现的问题,有问题就随时更新

The TLS connection was non-properly terminated

问题一:
(1) 问题描述:
git clone使用时出现“unable to access ‘https://github.com/smartdevicelink/sdl_core/’: gnutls_handshake() failed: The TLS connection was non-properly terminated.”

(2) 解决方法:
取消代理即可解决
git config --global --unset https.https://github.com.proxy
git config --global --unset http.http://github.com.proxy

问题二:
(1) 问题描述:
下载安装nvm的时候由于网速的原因出现如下问题:

sun@ubuntu:~/myProject/generic_hmi$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:01:00 --:--:--     0
curl: (35) gnutls_handshake() failed: The TLS connection was non-properly terminated.

(2) 解决方法:更改镜像地址,可以提高网速

sun@ubuntu:~/myProject/generic_hmi$ export NVM_NODEJS_ORG_MIRROR=https://npm.taobao.org/mirrors/node

error: RPC failed; curl 56 GnuTLS recv error (-54): Error in the pull function.

(1) 问题描述:
从github上git clone速度太慢,也就几十KiB/s,进而导致失败

sun@ubuntu:~/myProject$ git clone https://github.com/smartdevicelink/sdl_core
正克隆到 'sdl_core'...
remote: Enumerating objects: 282423, done.
error: RPC failed; curl 56 GnuTLS recv error (-54): Error in the pull function.
fatal: The remote end hung up unexpectedly
fatal: 过早的文件结束符(EOF)
fatal: index-pack failed

(2) 解决方法:
方法一(推荐使用):
使用Github的国内镜像网站。
https://hub.njuu.cf/
https://hub.yzuu.cf/
https://hub.nuaa.cf/
https://hub.fgit.ml/

例如:

git clone https://github.com/smartdevicelink/sdl_core.git 
变更为
git clone https://hub.njuu.cf/smartdevicelink/sdl_core.git 

方法二:
我们都知道网络访问的流程包含很多个步骤,在这其中的DNS解析需要花一定时间,所以可以考虑将域名和ip的映射放到hosts文件中,这样也就避免了域名通过DNS服务器去解析而花费较长时间,进而提高网速。

git clone需要的域名主要有两个:github.com 和 github.global.ssl.fastly.net,分别使用nslookup github.comnslookup github.global.ssl.fastly.net进行查看
在这里插入图片描述
然后将上面的域名和ip映射关系加入到/etc/hosts文件中(注意使用sudo打开),如下图所示
在这里插入图片描述


fatal: unable to access ‘xxx’: server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none

可能的原因是网站的ssl证书没有经过相应机构签署,导致验证的时候报错了。不过如果我们确认代码平台是安全的,可以将ssl证书验证暂时关闭,关闭方法如下:

方法一:设置环境变量GIT_SSL_NO_VERIFY为true
export GIT_SSL_NO_VERIFY=true

方法二(推荐):使用git命令配置变量http.sslVerify为false
git config http.sslVerify "false"  #这里设置为局部变量,如果想配置全局的在"git config"后面加上"--global"即可

这里比较推荐方法二,因为是局部变量,所以只对当前仓库生效,避免了潜在安全风险的进一步扩大

sun@192.168.1.21: Permission denied (publickey).

问题描述:
之前都是好用的,ubuntu从18.04升级到22.04后,执行git或者repo同步服务器代码时,碰见了这个问题。经过调查,原因是ubuntu22.04用的ssh是OpenSSH_8.9p1,这个版本的ssh取消了rsa加密算法,导致服务器匹配秘钥失败而报了这个错误。

解决方法:
修改/etc/ssh/ssh_config,添加如下内容

PubkeyAcceptedAlgorithms +ssh-rsa
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

星际工程师

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值