Search code examples
gitbitbucketgit-push

Git push fail: The remote end hung up unexpectedly AND failed to push some refs


New git user here.

I used to be able to run 'git push' commands but it just stopped working all of a sudden.

$ git push origin master
Enumerating objects: 29, done.
fatal: the remote end hung up unexpectedly
fatal: the remote end hung up unexpectedly
fatal: the remote end hung up unexpectedly
error: failed to push some refs to 'https://<user_name>@bitbucket.org/<user_name>/<file_name>.git'

I already updated Git for Windows

$ git --version
git version 2.19.1.windows.1

I already tried 'git pull' before add, commit and push

$ git pull
Already up to date.

I already tried a bigger buffer

$ git config http.postBuffer 100000000

I already removed a big file from my project. Not sure what else I can do.

While I have seen a few posts with one of the two git errors I have (remote end and pushing refs), none of them matched exactly what is happening to me nor fixed my issue.

Thanks in advance!

EDIT: I use Bitbucket and this issue is only happening on this Windows machine. No issues on another machine running MacOS.

If it helps, here is my git status on the Windows machine:

$ git status
On branch master
Your branch is ahead of 'origin/master' by 4 commits.
  (use "git push" to publish your local commits)

nothing to commit, working tree clean

Solution

  • Considering BitBucket status reports no issue, there must be an issue on your Windows machine.

    Try first to:

    I have some local changes on the Windows machine I can't lose

    Then, as a workaround, you can create a bundle of your local repo, copy the (one) file to your Mac, and pull from it. Then push from the local repo on your Mac.