git clone github报错解决方法,亲测有效!

报错如下:

git clone https://github.com/pingcap/tidb.git
Cloning into 'tidb'...
remote: Enumerating objects: 331426, done.
remote: Counting objects: 100% (1769/1769), done.
remote: Compressing objects: 100% (1549/1549), done.
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
error: 6372 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output

解决方法如下:

1、修改git配置,无效

git config --global http.lowSpeedTime 999999
git config --global http.lowSpeedLimit 0
git config --global http.postBuffer 524288000
git config --global http.version HTTP/1.1

2、配置github的ssh,通过ssh获取代码

生成密钥如下:

➜  ~ ssh-keygen -t rsa -C "*******@163.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/longfei/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/longfei/.ssh/id_rsa
Your public key has been saved in /Users/longfei/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:tRgpjDqz/PwfDnsNb68XUkXMtgbptFyC+lmqzRXVHNQ jianglf1107@163.com
The key's randomart image is:
+---[RSA 3072]----+
|           . =o=o|
|     o   .. = B E|
|    . o o..+ O . |
|   .   ..+ .B o  |
|  +     S..= o   |
| . +    . = o    |
|  o   . .B o .   |
|   o   +o.* .    |
|    o.ooo..+.    |
+----[SHA256]-----+

➜  ~ cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDmA/4ht1G3MvES9URxoKWHN/sewCwdwqX+ldDhpaWf4OsBV3GR7JEP9k/rVPcISxrJ5qfnvPVvX3K/swSWd6vcnsEM+3Ea7KPycUTy7P7VCo4QA31QH7uK/f+kfdpo+riteutO2b0/FO1vKEqIRx5+z+UmSAt54zyQtsUC20/EJkMUeWg1otip7Hejs2KPTqHLWc5ahEoW+gjJXmtVK1UIYhAiY+yjon46tYldRPDAwGR2MDTK7X7bYiYOVTBwQ9ToWOWs1lxm395R6xAXTKeVoHKmreGrolNVV8Eg8kz5qAJvVM6kSK7YaAR4xzmii3PoF6S2/05K2RNZ1twNOtv29TxSMbCQlQVaqnABCGZ6y0cplHwYtXREQ6zBkhlTnwqb29FQ+ETRXCIg+1zar5zUSfxSUTwnyHKzpWSTvkLVwNWJfsZ2+dquxHKNmcII2Ug0cIB8GeTApC+W5tKbUYbmJ9nbfm/Aw0jXWlG8RTJA1CpH1RKoLlmcF3wd6Ef4wZM= *******@163.com

登录github,选择settingsSSH and GPG keysNew SSH key添加自己的公钥。
图片名称

重新clone

➜  tidb_source git clone git@github.com:pingcap/tidb.git
Cloning into 'tidb'...
remote: Enumerating objects: 331434, done.
remote: Counting objects: 100% (1777/1777), done.
remote: Compressing objects: 100% (1553/1553), done.
Receiving objects: 100% (331434/331434), 412.07 MiB | 453.00 KiB/s, done.
remote: Total 331434 (delta 853), reused 678 (delta 221), pack-reused 329657
Resolving deltas: 100% (260664/260664), done.
Updating files: 100% (5950/5950), done.

搞定!

posted @ 2024-06-14 17:58  春风十里不如你i  阅读(568)  评论(0)    收藏  举报