This is a git issue that we ran into when we tried to push to a repository where we do not have permission. When we tried that we got the following issue:
ERROR: Permission to username/repository.git denied to username. fatal: The remote end hung up unexpectedly
This happened when one of the consoles was logged in using git user credential and tried to push to a repository where that git user does not have access. Another git user has the access that git repository. Since console was already logged in by one user, it was difficult to switch user in that terminal console. Every time we try to push to the repo we were getting that issue.
As soon as we tried the following git command it prompted for the username and password.
$ git config --local credential.helper "" $ git push origin master
When we tried with correct git username and password it worked nicely.