The error messages Connection reset by peer, Broken pipe, and the remote end hung up unexpectedly during a git push typically indicate that the connection between your Git client and the Azure DevOps server was interrupted while transferring data
C:\xybenetics>git push origin main
Enumerating objects: 96, done.
Counting objects: 100% (96/96), done.
Delta compression using up to 12 threads
client_loop: send disconnect: Connection reset by peer
send-pack: unexpected disconnect while reading sideband packet
Compressing objects: 100% (83/83), done.
fatal: sha1 file '<stdout>' write error: Broken pipe
fatal: the remote end hung up unexpectedly
C:\xybenetics>
This is often related to network stability, the size of your push, or specific Git/network software configurations. Since the push starts (enumerating, compressing objects) but fails during the writing phase, it suggests the connection drops under the load of the data transfer.
Here is a step-by-step guide to resolve the issue, starting with the most common and easiest fixes.
Quick Fixes
These solutions address the most frequent causes of this problem and can be implemented quickly.
Step 1: Increase the Git HTTP Buffer Size.
This is a very common solution for "broken pipe" errors during pushes, especially if your repository is large or contains large files. The default buffer might be too small, causing the connection to time out or drop . Open your terminal and run the following command to increase the buffer size to 500MB
git config --global http.postBuffer 524288000
Step 2: Downgrade the HTTP Version.
Sometimes, the newer HTTP/2 protocol can cause issues with certain networks or proxies, leading to resets. Forcing Git to use the older HTTP/1.1 protocol can often stabilize the connection. Run these commands one after the other:
git config --global http.version HTTP/1.1
This is how you revert the HTTP back to 2.0.
git config --global http.version HTTP/2
Step1: Switch to HTTPS.
SSH is very sensitive to large packet drops. Sometimes switching your remote URL to HTTPS allows the http.postBuffer you already configured (500 MB) to actually do its job.
git remote set-url origin https://#### Git Remote HTTPS URL ####
NOTE: It is HTTPS and not SSH.
git push origin main
And finally just to make sure that your transfer is via HTTP using this command.
And after that... perform a git push.
Voila! Your git push is working!
So there you have it. Connection reset by peer. Broken pipe. Two of the most annoying, mysterious, and downright frustrating errors in the Git world is solved!
If this video saved you time, saved you hair, or just saved you from throwing your laptop out the window—hit that like button. It helps more than you know. Cheers!
#git #github