Git clone error: RPC failed - curl 28 Operation too slow
Git clone error: RPC failed - curl 28 Operation too slow
我正在尝试克隆 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),结果相同...
诊断
设置
拱门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)
速度测试:
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
提高数值修复它。
我正在尝试克隆 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),结果相同...
诊断
设置
拱门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)
速度测试:
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
提高数值修复它。