Git push over ssh fails on windows with 'the remote end hung up unexpectedly' error

This, I've managed to solve by explicitly setting the global sshCommand config value as per Adam Ralph's suggestion.

Yes, but no: try first to use Git in a CMD session where you have put a simplified PATH, one in which the Git bundled openSSH will comes first and with be used (OpenSSH_8.2p1, OpenSSL 1.1.1d 10 Sep 2019) instead of the older one from Windows

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%

git config --gobal --unset core.sshCommand
cd C:\path\to\repo
git config --local --unset core.sshCommand

Then try again, in that CMD session, for testing if the SSH issue persists.


The connection is closed after writing a few bytes, target https://github.com/john-shaskin/polly-notes-reader Try the following:

run git bash(Do not use openssh, use git bash only) for windows, and enter the following commands

git config --global http.postBuffer 524288000
git config --global ssh.postBuffer 524288000

use simple settings for git push

git config --global push.default simple

change folder to repository you want to commit

cd /{driveletter}/{rootdir}/{repo}/{src}

cd /d/projects/repo/src <---- change accordingly.

now try

git push 

If you still get the error, you need to enable GIT_TRACE_PACKET=true and GIT_TRACE=2, post the error log here again, I'll help you through it.

Tags:

Git

Ssh

Github