Solved: Git Clone Large Repo Download Errors
When attempting to clone a large git repository over https, hosted on an on premise GitLab instance, I kept getting the error:
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
After attempting to clone it a few times, I tried just downloading the zip from GitLab, this would also fail halfway through. Next I thought I'd give cloning it with
--depth 1 a try, this is a trick I've used before to improve the speed of cloning a repo within a CI (where you are downloaded it fresh every time and don't need all the history). Setting the depth to 1 helped reduce the size it was downloading, but I couldn't get it fully cloned without an error.
Finally, I tried switching from http to ssh, this did the trick. I'm guessing the web server that was running GitLab might have had some timeouts set that were preventing it from working over http, but using ssh avoided that problem and it worked first try.