Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix 'packet_write_wait: Connection to ... Broken pipe' error in Git

Tags:

git

github

ssh

How can I fix the problem when I git push files to my remote repositories and it throw the error 'packet_write_wait: Connection to 13.250.177.223 port 22: Broken pipe'?Before git push, I had clone the project from the remote and git add, git commit successfully.

I haved tried git pull, git config http.postBuffer 52428800, but it doesn't work.

HP@EverChan MINGW32 /d/ChromeDownload/jiaoben5049/meetingDemo (master)
$ git pull
packet_write_wait: Connection to 52.74.223.119 port 22: Broken pipe
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
HP@EverChan MINGW32 /d/ChromeDownload/jiaoben5049/meetingDemo (master)
$ git config http.postBuffer 52428800
HP@EverChan MINGW32 /d/ChromeDownload/jiaoben5049/meetingDemo (master)
$ git push -u origin master
Counting objects: 46, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (46/46), done.
packet_write_wait: Connection to 13.250.177.223 port 22: Broken pipe
Writing foabjecttals:   8:% The  (4/4remote end hung up u6nex)pectedly
fatal: sha1 file '<stdout>' write error: Broken pipe
fatal: The remote end hung up unexpectedly
HP@EverChan MINGW32 /d/ChromeDownload/jiaoben5049/meetingDemo (master)
$ git push -u origin master
packet_write_wait: Connection to 13.250.177.223 port 22: Broken pipe
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.


like image 509
EverJust Avatar asked Jan 09 '19 03:01

EverJust


People also ask

How to increase git buffer size?

Resolution. Increase the Git buffer size to the largest individual file size of your repo: git config --global http. postBuffer 157286400.

What is Pipe error?

A broken Pipe Error is generally an Input/Output Error, which is occurred at the Linux System level. The error has occurred during the reading and writing of the files and it mainly occurs during the operations of the files.

Why is git pushing too long?

One possibility might be that you have large binary file(s) commited in the latest commit. git is not good at working with binary file. If commiting binary files was a mistake, you can refer to following answer for getting rid of binary file in commit.


2 Answers

What worked for me in the context of pushing my repo to github was adding IPQoS=throughput to my config file in ~/.ssh/config. The other steps for making sure SSH is are set up correctly, added to your Github account etc. are detailed here

like image 77
Tanya Gupta Avatar answered Oct 06 '22 08:10

Tanya Gupta


Make sure your SSH URL for your remote origin does work:

ssh -T yourServer

Its IP address should not change.

See if the issue persists with the latest Git for Windows (PortableGit-2.20.1-64-bit.7z.exe), uncompress in C:\Git, and set a simplified PATH in a CMD session.

set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\
set GH=C:\path\to\git
set PATH=%GH%\bin;%GH%\usr\bin;%GH%\mingw64\bin;%PATH%

Note: you can see arror messages with packet_write() failing.
Before, we gave an extra error message unnecessarily, which has been corrected with Git 2.32 (Q2 2021).

See commit 332ec96 (15 Apr 2021) by Matheus Tavares (matheustavares).
(Merged by Junio C Hamano -- gitster -- in commit 279a2e6, 30 Apr 2021)

pkt-line: do not report packet write errors twice

Signed-off-by: Matheus Tavares

On write() errors, packet_write() dies with the same error message that is already printed by its callee, packet_write_gently().
This produces an unnecessarily verbose and repetitive output:

error: packet write failed 
fatal: packet write failed: <strerror() message>  

In addition to that, packet_write_gently() does not always fulfill its caller expectation that errno will be properly set before a non-zero return.
In particular, that is not the case for a "data exceeds max packet size" error.
So, in this case, packet_write() will call die_errno() and print an strerror(errno) message that might be totally unrelated to the actual error.

Fix both those issues by turning packet_write() and packet_write_gently() into wrappers to a common lower level function that doesn't print the error message, but instead returns it on a buffer for the caller to die() or error() as appropriate.

like image 32
VonC Avatar answered Oct 06 '22 08:10

VonC