Search code examples
gitrepositorybroken-pipe

git push fails - fatal: the remote end hung up unexpectedly


I created a git repo locally. When I try to push to github, I get:

Warning: Permanently added the RSA host key for IP address '140.82.112.4' to the list of known hosts.
Enumerating objects: 47, done.
Counting objects: 100% (47/47), done.
Delta compression using up to 8 threads
Compressing objects: 100% (39/39), done.
Writing objects: 100% (47/47), 756.22 KiB | 9.11 MiB/s, done.
Total 47 (delta 7), reused 0 (delta 0), pack-reused 0
send-pack: unexpected disconnect while reading sideband packet
fatal: the remote end hung up unexpectedly
client_loop: send disconnect: Broken pipe

When I run git remote -v:

origin  git@github.com:crwils/react_unit_and_cypresstesting.git (fetch)
origin  git@github.com:crwils/react_unit_and_cypresstesting.git (push)

Tried increasing the git buffer size:

git config --global http.postBuffer 157286400

Based on various other, similar issues/solutions found on here, I've also tried:

  • git repack
  • deleting and creating a new SSH Key
  • deleting the .git file and reinitializing the repo then pushing
  • deleting the .git file, moving all files to new folder, initializing a new repo locally, then pushing to a new remote repo on github
  • changing to a different internet connection

This just started happening with some existing as well as new repo's, but not others, no theme apparent.

Can anybody help please?


Solution

  • Check first if using HTTPS instead of SSH would work: that would isolate the issue on SSH port 22.

    cd /path/to/react_unit_and_cypresstesting
    git remote set-url https://github.com/crwils/react_unit_and_cypresstesting.git
    git push
    

    You will have to enter your GitHub username/password, but they can be cached in a credential helper.