Git RPC失败; curl 18 传输关闭,剩余未完成的读取数据

Git RPC failed; curl 18 transfer closed with outstanding read data remaining

任何 git 超过一定大小的回购克隆都会在中途失败,我可以使用 ssh 方法,但是对于这种情况,http 是必需的,因为它是 brew 安装的一部分的辅助操作。

$ brew cask install homebrew/cask-versions/adoptopenjdk8

==> Tapping homebrew/cask
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask'...
remote: Enumerating objects: 422119, done.
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
Error: Failure while executing; `git clone https://github.com/Homebrew/homebrew-cask /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask` exited with 128.
Follow the instructions here:
  https://github.com/Homebrew/homebrew-cask#reporting-bugs
/usr/local/Homebrew/Library/Homebrew/utils.rb:266:in `safe_system'
/usr/local/Homebrew/Library/Homebrew/tap.rb:273:in `install'
/usr/local/Homebrew/Library/Homebrew/cask/cmd.rb:157:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/cmd.rb:123:in `run'
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:9:in `cask'
/usr/local/Homebrew/Library/Homebrew/brew.rb:103:in `<main>'

这是在一台全新的机器上,具有非常快的互联网连接(已验证 git 克隆在其他机器上工作)。另外我增加了缓冲区大小

git config --global http.postBuffer 524288000

我在 http 和 ssh 方法中克隆小型存储库都没有问题。 我已经查看了类似的堆栈问题,例如下面的问题,但它们不涵盖这种情况。

error: RPC failed; curl transfer closed with outstanding read data remaining

如果问题仍然存在,这意味着如果您在自己尝试时看到相同的错误消息:

git clone https://github.com/Homebrew/homebrew-cask /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask

然后尝试:

  • 要么是 SSH 克隆:

    git clone git@github.com:Homebrew/homebrew-cask /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask
    
  • git clone --depth 1 https://github.com/Homebrew/homebrew-cask /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask
    cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask
    git fetch --unshallow
    

事实证明,在我的情况下,它确实是一种我不知道的反病毒软件,Virgin Broadband ISP 使用内置的 Virus Safe,我不知道它是在未经我同意的情况下激活的。对于拥有此 isp 的用户,可以通过 https://my.virginmedia.com/my-apps/onlinesecurity/websafe/settings

将其停用

我手动下载了install.sh文件,修改BREW_REPOBREW_REPO="git@github.com:Homebrew/brew",然后运行sh install.sh

&tldr; brew update-reset

我刚刚遇到了同样的问题。首先,我尝试了@VonC 的回答,但没有帮助。 我收到消息

➜  ~ git clone git@github.com:Homebrew/homebrew-cask /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask
fatal: destination path '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask' already exists and is not an empty directory.

接下来通过谷歌搜索该消息给了我 this link 运行 命令

的解决方案(如果是我的)
brew update-reset

问题解决后

➜  ~ brew update-reset
==> Fetching /usr/local/Homebrew...
remote: Enumerating objects: 61, done.
remote: Counting objects: 100% (34/34), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 7 (delta 4), reused 3 (delta 0), pack-reused 0
Unpacking objects: 100% (7/7), 3.55 KiB | 454.00 KiB/s, done.
From https://github.com/Homebrew/brew
 * [new branch]          imgbot     -> origin/imgbot

==> Resetting /usr/local/Homebrew...
Branch 'master' set up to track remote branch 'master' from 'origin'.
Reset branch 'master'

==> Fetching /usr/local/Homebrew/Library/Taps/dart-lang/homebrew-dart...

==> Resetting /usr/local/Homebrew/Library/Taps/dart-lang/homebrew-dart...
Branch 'master' set up to track remote branch 'master' from 'origin'.
Reset branch 'master'
Your branch is up to date with 'origin/master'.

==> Fetching /usr/local/Homebrew/Library/Taps/elastic/homebrew-tap...

==> Resetting /usr/local/Homebrew/Library/Taps/elastic/homebrew-tap...
Branch 'master' set up to track remote branch 'master' from 'origin'.
Reset branch 'master'
Your branch is up to date with 'origin/master'.

==> Fetching /usr/local/Homebrew/Library/Taps/heroku/homebrew-brew...

==> Resetting /usr/local/Homebrew/Library/Taps/heroku/homebrew-brew...
Branch 'master' set up to track remote branch 'master' from 'origin'.
Reset branch 'master'
Your branch is up to date with 'origin/master'.

==> Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask...

==> Resetting /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask...
Branch 'master' set up to track remote branch 'master' from 'origin'.
Reset branch 'master'
Your branch is up to date with 'origin/master'.

==> Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask-versions...

==> Resetting /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask-versions...
Branch 'master' set up to track remote branch 'master' from 'origin'.
Reset branch 'master'
Your branch is up to date with 'origin/master'.

==> Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core...
fatal: unable to access 'https://github.com/Homebrew/homebrew-core/': transfer closed with outstanding read data remaining

==> Resetting /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core...
Branch 'master' set up to track remote branch 'master' from 'origin'.
Reset branch 'master'
Your branch is up to date with 'origin/master'.

==> Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-services...

==> Resetting /usr/local/Homebrew/Library/Taps/homebrew/homebrew-services...
Branch 'master' set up to track remote branch 'master' from 'origin'.
Reset branch 'master'
Your branch is up to date with 'origin/master'.

==> Fetching /usr/local/Homebrew/Library/Taps/sass/homebrew-sass...

==> Resetting /usr/local/Homebrew/Library/Taps/sass/homebrew-sass...
Branch 'master' set up to track remote branch 'master' from 'origin'.
Reset branch 'master'
Your branch is up to date with 'origin/master'

尽管我发现获取时出现问题 homebrew-core 所有操作都已成功完成并且我能够更新包

➜  ~ brew update && brew upgrade && brew cleanup
Updated 1 tap (homebrew/core).
==> New Formulae
cloudformation-guard
==> Updated Formulae
aws-okta              bitrise               cbmc                  crowdin               frpc                  monero                openrct2              ssh-audit             traefik
==> Upgrading 1 outdated package:
heroku/brew/heroku 7.43.2 -> 7.44.0
==> Upgrading heroku/brew/heroku 7.43.2 -> 7.44.0
==> Downloading https://cli-assets.heroku.com/heroku-v7.44.0/heroku-v7.44.0.tar.xz
######################################################################## 100.0%
==> Caveats
To use the Heroku CLI's autocomplete --
  Via homebrew's shell completion:
    1) Follow homebrew's install instructions https://docs.brew.sh/Shell-Completion
        NOTE: For zsh, as the instructions mention, be sure compinit is autoloaded
          and called, either explicitly or via a framework like oh-my-zsh.
    2) Then run
      $ heroku autocomplete --refresh-cache

  OR

  Use our standalone setup:
    1) Run and follow the install steps:
      $ heroku autocomplete

Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completions have been installed to:
  /usr/local/share/zsh/site-functions
==> Summary
  /usr/local/Cellar/heroku/7.44.0: 27,477 files, 59.4MB, built in 40 seconds
Removing: /usr/local/Cellar/heroku/7.43.2... (27,475 files, 59.4MB)
Removing: /Users/tpojka/Library/Caches/Homebrew/heroku--7.43.2.tar.xz... (6.9MB)
Removing: /Users/tpojka/Library/Caches/Homebrew/libyaml--0.2.5.catalina.bottle.tar.gz... (107.4KB)
Removing: /Users/tpojka/Library/Caches/Homebrew/nghttp2--1.41.0.catalina.bottle.tar.gz... (968.6KB)
Removing: /Users/tpojka/Library/Logs/Homebrew/htop... (64B)
Removing: /Users/tpojka/Library/Logs/Homebrew/guile... (64B)
Removing: /Users/tpojka/Library/Logs/Homebrew/gnupg... (64B) 

由于之前看到的错误,我又使用了 brew update-reset 命令,然后一切顺利,没有错误:

➜  ~
➜  ~ brew update-reset
==> Fetching /usr/local/Homebrew...

==> Resetting /usr/local/Homebrew...
Branch 'master' set up to track remote branch 'master' from 'origin'.
Reset branch 'master'
Your branch is up to date with 'origin/master'.

==> Fetching /usr/local/Homebrew/Library/Taps/dart-lang/homebrew-dart...

==> Resetting /usr/local/Homebrew/Library/Taps/dart-lang/homebrew-dart...
Branch 'master' set up to track remote branch 'master' from 'origin'.
Reset branch 'master'
Your branch is up to date with 'origin/master'.

==> Fetching /usr/local/Homebrew/Library/Taps/elastic/homebrew-tap...

==> Resetting /usr/local/Homebrew/Library/Taps/elastic/homebrew-tap...
Branch 'master' set up to track remote branch 'master' from 'origin'.
Reset branch 'master'
Your branch is up to date with 'origin/master'.

==> Fetching /usr/local/Homebrew/Library/Taps/heroku/homebrew-brew...

==> Resetting /usr/local/Homebrew/Library/Taps/heroku/homebrew-brew...
Branch 'master' set up to track remote branch 'master' from 'origin'.
Reset branch 'master'
Your branch is up to date with 'origin/master'.

==> Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask...

==> Resetting /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask...
Branch 'master' set up to track remote branch 'master' from 'origin'.
Reset branch 'master'
Your branch is up to date with 'origin/master'.

==> Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask-versions...

==> Resetting /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask-versions...
Branch 'master' set up to track remote branch 'master' from 'origin'.
Reset branch 'master'
Your branch is up to date with 'origin/master'.

==> Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core...

==> Resetting /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core...
Branch 'master' set up to track remote branch 'master' from 'origin'.
Reset branch 'master'
Your branch is up to date with 'origin/master'.

==> Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-services...

==> Resetting /usr/local/Homebrew/Library/Taps/homebrew/homebrew-services...
Branch 'master' set up to track remote branch 'master' from 'origin'.
Reset branch 'master'
Your branch is up to date with 'origin/master'.

==> Fetching /usr/local/Homebrew/Library/Taps/sass/homebrew-sass...

==> Resetting /usr/local/Homebrew/Library/Taps/sass/homebrew-sass...
Branch 'master' set up to track remote branch 'master' from 'origin'.
Reset branch 'master'
Your branch is up to date with 'origin/master'.

➜  ~

我不太确定为什么会这样,但可能与 OS 更新有关(发生在此处)。我收到了将 OS 升级到 10.15.7 一天的通知,即使在更新 OS.

之后,初始 brew 错误仍然存​​在

这是 Virgin ISP 设置。我将 https://github.com 添加为允许的网站:https://my.virginmedia.com/my-apps/onlinesecurity/websafe/settings

请注意,我从之前的尝试 (sudo rm -rf /usr/local/HomeBrew) 中删除了 /usr/local/HomeBrew 目录,然后按照标准安装说明删除了 运行 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

万岁...!

==> Installation successful!

打开您的 git 文件夹并删除 FETCH_HEAD 文件,然后再次推送 跳

这些答案实际上并不能解决问题,其中一些可能会解决问题,但您的问题会再次出现。

禁用tcp-udp卸载

Darwin/MacOS

sudo sysctl -w net.link.generic.system.hwcksum_tx=0
sudo sysctl -w net.link.generic.system.hwcksum_rx=0

GNU/Linux;

sudo ethtool -K eth0 tx off rx off`

您的计算机正在 'real time' 尝试调整您的网卡以适应负载,但失败了。

您可能遇到的其他相关问题:

NPM Timeout on install while overseas

Note: I use 'real time' as the relative passage of time, not as a measurement for CPU Cylces/performance modulation for your OS