Press enter to see results or esc to cancel.

fatal: The remote end hung up unexpectedly

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”