Nov 16 2010

fatal: The remote end hung up unexpectedly

Published by at 8:47 am under Miscellaneous

I committed changes to my GIT project, tried to push them to the remote server (git push) and got the following cryptic error message:

fatal: The remote end hung up unexpectedly

The GitFaq states that:

Git push fails with “fatal: The remote end hung up unexpectedly”?
If, when attempting git push, you get a message that says:
fatal: The remote end hung up unexpectedly

There are a couple of reasons for that, but the most common is that authorization failed. You might be using a git:// URL to push, which has no authorization whatsoever and hence has write access disabled by default. Or you might be using an ssh URL, but either your public key was not installed correctly, or your account does not have write access to that repository/branch.

I used “git config –list” to review my project configuration

core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
remote.origin.url=git://git.some-domain.com/my-project
branch.master.remote=origin
branch.master.merge=refs/heads/master
branch.v2.remote=origin
branch.v2.merge=refs/heads/v2
gui.geometry=1374×727+34+82 301 201

The culprit here is the “remote.origin.url” property, it’s pointing to a read-only repository. We can change this using “git config –edit”. We want to change:

remote.origin.url=git://git.some-domain.com/my-project

to

remote.origin.url=git@git.some-domain.com:/my-project

Please note that the specific user “git” is specific to my setup and your GIT setup/configuration is most likely different. After this change I was able to successfully push my changes to the remote server.

The reason to why I got the read-only version of the project was because I used “git clone git://git.some-domain.com/my-project” when I should have used “git clone git@git.some-domain.com:/my-project”

6 responses so far

6 Responses to “fatal: The remote end hung up unexpectedly”

  1. Maxou says:

    Thanks! I encountred this problem, and you saved me hours ^^

  2. JabbyPanda says:

    Thanks for this informative and well written post.

    I was in the same situation today as you
    and your post was very helpful to me.

  3. Tberg says:

    BEST POST EVER for solving this!
    I had connected via the “git-ready-only”, which got me into the condition you solve.

    Only thing I needed besides this post was a VIM cheat-sheet :)

  4. Gregory Patmore says:

    I had a similar issue on a Windows machine.

    However it tried to use TortoiseSVN’s plink exe, which didn’t work.

    I found the answer here: http://help.github.com/ssh-issues/
    under “No supported authentication methods available”

    at the end of the section it speaks about reverting to using open ssh. This worked for me.

    you can test if this will work for you by typing the following into gitbash

    GIT_SSH=’C:Program FilesGitbinssh.exe’

    …If it works you can edit that env setting in C:Program FilesGitsetup.ini so you don’t have to set the variable every time you log into the shell.

    hope this helps someone.

  5. [...] a bit of searching and digging around on the net, I came across fatal: The remote end hung up unexpectedly and the obvious setup instructions on github. But the real gem that helped me out was Github [...]

  6. Moreno says:

    Thanks, great time saving tip!

    In my case though I had to change the urls the other way around.

Leave a Reply