title: Git RPC failed; curl 18 transfer closed with outstanding read data remaining
body: <p>Any git clone of a repo above a certain size fails halfway through, I can use ssh method however for this case http is required as it is a secondary action as part of brew install. </p>
  
  <pre><code>$ brew cask install homebrew/cask-versions/adoptopenjdk8
  
  ==&gt; 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 `&lt;main&gt;'
  </code></pre>
  
  <p>This is on a brand new machine, with a very fast internet connection (verified the git clone works on other machines). Additionally I have increased buffer size </p>
  
  <pre><code>git config --global http.postBuffer 524288000
  </code></pre>
  
  <p>I have no problem cloning small repos in both http and ssh method. 
  I have reviewed similar stack questions such as the one below but they don't cover this scenario.</p>
  
  <blockquote>
    <p>error: RPC failed; curl transfer closed with outstanding read data
    remaining</p>
  </blockquote>