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

Hirosh Tharaka
2 min readApr 1, 2024

If you are in this page, then it is surely because you have come accross the following error when you are trying to clone a repository (which is large with or without knowing for yor visibility and knowledge)

$ git clone https://github.com/******/test_repo.git
Cloning into 'test_repo'...
remote: Enumerating objects: 24587, done.
remote: Counting objects: 100% (793/793), done.
remote: Compressing objects: 100% (329/329), done.
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
error: 2006 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output

Following will be the fix / solution to by pass through the error and get the repository cloned.

Step 1: Shallow the clone : git clone <Repo Link> — depth 1

$ git clone http://github.com/******/test_repo.git --depth 1
Cloning into 'test_repo'...
warning: redirecting to https://github.com/******/test_repo/
remote: Enumerating objects: 242, done.
remote: Counting objects: 100% (242/242), done.
remote: Compressing objects: 100% (193/193), done.
remote: Total 242 (delta 10), reused 123 (delta 2), pack-reused 0
Receiving objects: 100% (242/242), 29.77 MiB | 214.00 KiB/s, done.
Resolving deltas: 100% (10/10), done.

Step 2: Navigate in the local repository folder

$ cd test_repo/

Step 3: Enter fetch — unshallow

$ git fetch --unshallow
warning: redirecting to https://github.com/******/test_repo.git/
remote: Enumerating objects: 22668, done.
remote: Counting objects: 100% (22668/22668), done.
remote: Compressing objects: 100% (6380/6380), done.
remote: Total 22478 (delta 12032), reused 22165 (delta 11750), pack-reused 0
Receiving objects: 100% (22478/22478), 20.98 MiB | 210.00 KiB/s, done.
Resolving deltas: 100% (12032/12032), completed with 116 local objects.
warning: redirecting to https://github.com/*****/test_repo.git/
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
From http://github.com/******/test_repo
* [new tag] 2.2.0 -> 2.2.0
* [new tag] 2.2.1 -> 2.2.1
* [new tag] 2.2.2 -> 2.2.2
* [new tag] 3.0.0 -> 3.0.0
* [new tag] 3.0.1_beta -> 3.0.1_beta

Reason for this would be mostly due to when you have happened to clone a large repository from a slow internet connection, and the connection tends to close.

--

--

Hirosh Tharaka
Hirosh Tharaka

Written by Hirosh Tharaka

BSc(Hons), CSM®, ISTQB® (CTFL, CTAL-TTA, CTAL-TM) | Technical Writer | Technical Tester (QA Lead)

No responses yet