简体   繁体   English

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

[英]Git clone error: RPC failed - curl 28 Operation too slow

I am trying to clone the linux kernel, the transfer speed seems perfectly fine, but curl always aborts:我正在尝试克隆 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

I have tried adding or removing --depth as well as using a different machine (one using Arch, the other on Ubuntu), same result...我尝试添加或删除--depth以及使用不同的机器(一个使用 Arch,另一个使用 Ubuntu),结果相同......

Diagnostics诊断

Setup设置

Arch Linux拱形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

Retry重试

On a new day, it now gets a little further:在新的一天,它现在更进一步:

❯ 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)

but still aborts whenever the transfer slows down for a few seconds:但每当传输速度减慢几秒钟时仍会中止:

❯ 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)

The solution seems to be to pass --speed-time to curl via git , which I have no idea how to do even after looking at all git man pages related to configuration I could find.解决方案似乎是通过git--speed-time传递给curl ,即使在查看了与我能找到的配置相关的所有 git 手册页后,我也不知道该怎么做。

After lots of frustration it became apparent that the problem was once again in front of the computer.在经历了很多挫折之后,很明显问题再次出现在计算机面前。 The following option in my git config was the culprit:我的 git 配置中的以下选项是罪魁祸首:

[http]
    lowSpeedLimit = 1000
    lowSpeedTime = 3

Raising the values fixed it.提高值修复了它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM