Git push fails with "error: unexpected disconnect while reading sideband packet fatal: the remote end hung up unexpectedly"
Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.
Summary
- The purpose of this article is to detail why this issue occurs and provide troubleshooting steps to resolve the issue.
Environment
- Performing a GIT push over HTTPS to a repository hosted in Bitbucket Cloud
Diagnosis
When attempting to push to a GIT repository, you encounter some variant of the following error message, and the push is blocked as a result:
error: unexpected disconnect while reading sideband packet fatal: the remote end hung up unexpectedly
Cause
- There are either speed/connectivity issues with your local network, or issues with your configured HTTPS settings
Solution
As a first step, troubleshoot your local network connection by performing a test repository clone and analysing the reported speed, if the clone fails with the same error or the speed is less than 200 KiB/s - reset your internet router or try a different connection
If the clone is successful and the speed is acceptable, but your repository push is still failing - increase your HTTP post buffer setting by executing the command below. When you perform a push operation over HTTPS, Git sends the data in a POST request. If the size of this request exceeds the limit, the push may fail with an error such as the above indicating a timeout or other connection issue:
git config --global http.postBuffer 157286400
NOTE: The above command increases the postBuffer size to 150MB (in bytes) as an example, you may need to increase this further depending on the size of your push.
If you are unable to resolve the issue after following this documentation - please raise a support ticket or a community support ticket for further assistance.