How can I resolve fetch-pack: unexpected disconnect while reading sideband packet
Asked by Ruma Kumari:

$ git clone [https://innersource.\*.com/\*repoName.git](https://innersource.*.com/*repoName.git)  
Cloning into 'repoName'...  
remote: Enumerating objects: 2845, done.  
remote: Counting objects: 100% (2845/2845), done.  
remote: Compressing objects: 100% (2615/2615), done.  
error: 2272 bytes of body are still expected \| 2.14 MiB/s  
fetch-pack: unexpected disconnect while reading sideband packet  
fatal: early EOF  
fatal: fetch-pack: invalid index-pack output


Answers:
author: Victor Menes
body: Hey Ruma,

Let's try to help you out here as I've seem some other users with the same issue.

In the past, I've seem below command being ran by the user received the error while trying to clone and it got resolved.

* Let's try to resolve the issue by increasing buffer:  

  ```
  git config --global http.postBuffer 52428800
  ```

<!-- -->

* Turn off the compression  

  ```
  git config --global core.compression 0
  ```

<!-- -->

* Try the workaround here:  

  ```
  $ git clone https://innersource.%2A.com/*repoName.git --depth 1$ cd repository$ git fetch --unshallow
  ```

Please let me know if that was helpful and if it resolved it :)

comments: author: Akshi Srivastava
body: Thanks,

It works for me


author: David Leach
body: while this is an answer I don't understand why this only occurs against a bitbucket server. I have NEVER seen this error when pulling from GitHub so what is it about bitbucket servers that invoke this error?


author: DJ Stomp
body: Oh, it happens with GitHub too.

![a4j9Pyb](https://community.atlassian.com/t5/image/serverpage/image-id/308485iD8A2BB60A66E9831/image-size/large?v=v2&px=999 "a4j9Pyb")


author: David Leach
body: I see that it did for you. I have literally never seen it happen in the 4+ years I've been engaging with GitHub. But I can pretty much get it to happen 50-70% of the time to our internal bitbucket.


author: karoofish
body: Oh, it does.

This has happened on several occasions to me.

This is just the latest round of looking for solutions for github.

```
karoofish@endeavour ~/d/r/egui (master)> git fetch --unshallow
remote: Enumerating objects: 37799, done.
remote: Counting objects: 100% (37799/37799), done.
remote: Compressing objects: 100% (8446/8446), done.
error: 6712 bytes of body are still expected MiB | 281.00 KiB/s
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output
```


author: abougouffa
body: I think this is related to Git LFS. You can try to install and enable Git LFS and try cloning the repo again.

```
# Install git-lfs with your package manager
sudo apt install git-lfs

# Enable Git LFS
git lfs install

# Clone the problematic repo
git clone path/to/repo.git
```


author: Ricardo Bol?var
body: It doesn't always fix it, it seems. I've never had this error before, but it happened when trying to clone a Github repo (that I've never tried before) by Github Desktop as well as by git clone the URL, and now again while trying the "fix".  

<br />

```
git config --global http.postBuffer 52428800

git config --global core.compression 0

cd /Volumes/WD_Elements2018/GitHub/

git clone https://github.com/eliranwong/UniqueBible.git --depth 1
Cloning into 'UniqueBible'...
remote: Enumerating objects: 187613, done.
remote: Counting objects: 100% (187613/187613), done.
remote: Compressing objects: 100% (186984/186984), done.
error: RPC failed; curl 92 HTTP/2 stream 5 was not closed cleanly: CANCEL (err 8)
error: 1378 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output
```

:(

comments: author: Ricardo Bol?var
body: Further information on this repo. I'm currently trying the zip download from Github, and it's "resuming ..." at around 250 MB. Earlier when cloning with Github Desktop it was around 200MB and only reported as 2 or 3% progressed, before I had received the unexpected disconnect, and all of that, the first time! So this might be one of the larger Github repo's I've tried to download.  

Also, I'm not on my home Internet, but on shared hotel Internet, and the speed is not so fast, although it's not unusual to sometimes get slow Github downloads.


author: Birhanu Shiferaw
body: remote: Enumerating objects: 340, done.  
remote: Counting objects: 100% (305/305), done.  
remote: Compressing objects: 100% (114/114), done.  
error: 7461 bytes of body are still expected \| 207.00 KiB/s  
fetch-pack: unexpected disconnect while reading sideband packet  
fatal: early EOF  
fatal: fetch-pack: invalid index-pack output i have faced this error what shall i do


author: Ricardo Bol?var
body: I still don't know why exactly it happened, but three months after my previous attempt, with the same problem, I just tried downloading it again, and it cloned without any error and completed in several minutes. So I can only suppose that *try again later* is the likely solution.


Tags: bitbucket-server

server