Little Git Tricks: Fix Unexpected Disconnect on Sideband Packet

I run into a strange error while trying to clone a Git repository from Azure DevOps on the command line:

Read from remote host vs-ssh.visualstudio.com: Connection reset by peer
client_loop: send disconnect: Connection reset by peer
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output

The default output of Git did not give me any clues on what went wrong, so I tried to increase the log output with these three environment variables:

1
2
3
$env:GIT_TRACE_PACKET=1
$env:GIT_TRACE=1
$env:GIT_CURL_VERBOSE=1

That increased the output, but did not help in finding the solution. Googling the problem offered many ideas, but waiting 15 minutes between each attempt made this a frustrating experience. Especially when the problem persisted no matter what I tried.

It was time to try something new and see if there was a newer version of Git. On my machine I had version 2.47:

git --version
git version 2.47.0.windows.1

The current version of Git was 2.49, that I could instal with winget command:

winget upgrade --id Git.Git

A quick check showed that the new version was up and running:

git --version
git version 2.49.0.windows.1

Even better, with this version the strange problem was gone, and I finally could clone my repository. Should you run into this problem, do not waste time and update Git right away!