Git克隆错误:RPC失败- curl 28操作太慢



我正在尝试克隆linux内核,传输速度似乎很好,但curl总是中止:

❯ git clone --depth 1 https://github.com/archlinux/linux
Cloning into 'linux'...
remote: Enumerating objects: 78109, done.
remote: Counting objects: 100% (78109/78109), done.
error: RPC failed; curl 28 Operation too slow. Less than 1000 bytes/sec transferred the last 3 seconds
fatal: early EOF
fatal: fetch-pack: invalid index-pack output

我已经尝试添加或删除--depth以及使用不同的机器(一个使用Arch,另一个在Ubuntu上),相同的结果…

诊断

设置Arch Linux

❯ git --version
git version 2.33.1
❯ curl --version
curl 7.79.1 (x86_64-pc-linux-gnu) libcurl/7.79.1 OpenSSL/1.1.1l zlib/1.2.11 brotli/1.0.9 zstd/1.5.0 libidn2/2.3.2 libpsl/0.21.1 (+libidn2/2.3.0) libssh2/1.9.0 nghttp2/1.45.1
Release-Date: 2021-09-22
Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets zstd
❯ ldd "$(which curl)"
linux-vdso.so.1 (0x00007ffcde7df000)
/usr/lib/libstderred.so (0x00007fbb71615000)
libcurl.so.4 => /usr/lib/libcurl.so.4 (0x00007fbb71541000)
libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007fbb71520000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007fbb71354000)
libdl.so.2 => /usr/lib/libdl.so.2 (0x00007fbb7134d000)
libnghttp2.so.14 => /usr/lib/libnghttp2.so.14 (0x00007fbb71321000)
libidn2.so.0 => /usr/lib/libidn2.so.0 (0x00007fbb712fd000)
libssh2.so.1 => /usr/lib/libssh2.so.1 (0x00007fbb712bc000)
libpsl.so.5 => /usr/lib/libpsl.so.5 (0x00007fbb712a9000)
libssl.so.1.1 => /usr/lib/libssl.so.1.1 (0x00007fbb71217000)
libcrypto.so.1.1 => /usr/lib/libcrypto.so.1.1 (0x00007fbb70f38000)
libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x00007fbb70ee3000)
libzstd.so.1 => /usr/lib/libzstd.so.1 (0x00007fbb70dd2000)
libbrotlidec.so.1 => /usr/lib/libbrotlidec.so.1 (0x00007fbb70dc4000)
libz.so.1 => /usr/lib/libz.so.1 (0x00007fbb70daa000)
/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007fbb71653000)
libunistring.so.2 => /usr/lib/libunistring.so.2 (0x00007fbb70c28000)
libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x00007fbb70b41000)
libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x00007fbb70b0e000)
libcom_err.so.2 => /usr/lib/libcom_err.so.2 (0x00007fbb70b08000)
libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x00007fbb70af8000)
libkeyutils.so.1 => /usr/lib/libkeyutils.so.1 (0x00007fbb70af1000)
libresolv.so.2 => /usr/lib/libresolv.so.2 (0x00007fbb70ad7000)
libbrotlicommon.so.1 => /usr/lib/libbrotlicommon.so.1 (0x00007fbb70ab4000)

Speedtest:

curl -o /dev/null http://speedtest.tele2.net/100MB.zip  0,16s user 0,57s system 5% cpu 14,183 total

重试

在新的一天,它现在走得更远了:

❯ git clone --depth 1 https://github.com/archlinux/linux
Cloning into 'linux'...
remote: Enumerating objects: 78109, done.
remote: Counting objects: 100% (78109/78109), done.
remote: Compressing objects:  36% (26365/73234)

,但当传输速度减慢几秒钟时仍会终止:

❯ git clone --depth 1 https://github.com/archlinux/linux
Cloning into 'linux'...
remote: Enumerating objects: 78109, done.
remote: Counting objects: 100% (78109/78109), done.
remote: Compressing objects:  36% (26365/73234)

解决方案似乎是通过git--speed-time传递给curl,我不知道怎么做,即使看了所有git手册页相关的配置,我能找到。

在经历了许多挫折之后,问题再次出现在电脑前。我的git配置中的以下选项是罪魁祸首:

[http]
lowSpeedLimit = 1000
lowSpeedTime = 3

提高值修复它。

相关内容

  • 没有找到相关文章

最新更新