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

When I tried to clone a decently-huge git repository I got the error below. The most common issue is that the connection closes and the whole clone is cancelled.

After a lot of trial and errors and a lot of “remote end hung up unexpectedly” I have a way that works for me. The idea is to do a shallow clone first and then update the repository with its history.

Good luck!

Want me to do this for you? Drop me a line: itgalaxyzzz {at} gmail [dot] com