Git Series Explanation (6): Summary of Problems in Git Use

Record the problems that may arise during use, and update them at any time if there are any problems

The TLS connection was non-properly terminated

Problem 1:
(1) Problem description:
"unable to access 'https://github.com/smartdevicelink/sdl_core/': gnutls_handshake() failed: The TLS connection was non-properly terminated." when using git clone

(2) Solution:
Cancel the proxy to solve
git config --global --unset https.https://github.com.proxy
git config --global --unset http.http://github.com.proxy

Problem 2:
(1) Problem description:
When downloading and installing nvm, the following problems occur due to network speed:

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) Solution: Change the mirror address to improve the network speed

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) Problem description:
The speed of git clone from github is too slow, only tens of KiB/s, which leads to failure

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) Solution:
Method 1 (recommended):
use Github's domestic mirror website.
https://hub.njuu.cf/
https://hub.yzuu.cf/
https://hub.nuaa.cf/
https://hub.fgit.ml/

For example:

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

Method 2:
We all know that the network access process includes many steps, and DNS resolution takes a certain amount of time, so you can consider putting the domain name and ip mapping into the hosts file, which also prevents the domain name from passing through the DNS server It takes a long time to parse, thereby increasing the speed of the network.

nslookup github.comThere are two main domain names required by git clone: ​​github.com and github.global.ssl.fastly.net, use and nslookup github.global.ssl.fastly.netview respectively,
insert image description here
and then add the above domain name and ip mapping relationship to the /etc/hosts file (note the use of sudo open), as shown below
insert image description here


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

The possible reason is that the ssl certificate of the website has not been signed by the corresponding organization, resulting in an error during verification. However, if we confirm that the code platform is safe, we can temporarily close the ssl certificate verification. The closing method is as follows:

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

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

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

[email protected]: Permission denied (publickey).

Description of the problem:
It was easy to use before. After upgrading ubuntu from 18.04 to 22.04, I encountered this problem when executing git or repo to synchronize the server code. After investigation, the reason is that the ssh used by ubuntu22.04 is OpenSSH_8.9p1. This version of ssh canceled the rsa encryption algorithm, which caused the server to fail to match the secret key and reported this error.

Solution:
modify /etc/ssh/ssh_config, add the following content

PubkeyAcceptedAlgorithms +ssh-rsa

Guess you like

Origin blog.csdn.net/In_engineer/article/details/122254974