Git - error: RPC failed; result=22, HTTP code = 401 fatal: The remote end hung up unexpectedly

44,881

Solution 1

You must have made a mistake in the remote URL, double-check the output with git remote -v and fix it with

 git remote set-url origin <new-url>

assuming the remote name is origin

Solution 2

For people who using TFS git repositories while on Windows. My Windows password recently changed therefor i had

error RPC failed; result=22, HTTP code = 401 fatal: The remote end hung up unexpectedly

when doing diffrent things like fetch, push or pull. We using TFS git repo. I fixed this problem deleting my tfs password from Windows Credential Manager through Control Panel. https://support.microsoft.com/help/4026814/windows-accessing-credential-manager .

Solution 3

The problem solved right after update to git version 1.8.x

Solution 4

In my case, user permission was the problem. I added myself as a valid user of the repository after which 'Push' worked.

Solution 5

FWIW, I had the same problem and solved it by removing and re-adding the remote:

git remote remove origin
git remote add origin http://host:port/my/repo
git branch --set-upstream master origin/master

This assumes that you are on the master branch and your only remote is origin.

Share:
44,881
Admin
Author by

Admin

Updated on July 09, 2022

Comments

  • Admin
    Admin almost 2 years

    I am using ubuntu 11.10 machine. I have installed git of version 1.7.7.1. I am using git-cola to push and pull my code and I was able to commit and push my changes successfully.

    Now, I have changed my machine and my new system is with the same above configurations. (Ubuntu 11.10 machine and git version 1.7.7.1).

    In the new machine, I have issues on git push. I got the following error message when I tried to push my code:

    error: RPC failed; result=22, HTTP code = 401
    fatal: The remote end hung up unexpectedly
    fatal: The remote end hung up unexpectedly
    

    On internet, I found it may due to any one of the following reason:

    • Wrong git user password (In my case, I fee that I am using the correct password to push the code. Because, even now I was successful, when I push workspace code from my old system (with the same password!). But the problem is only from my new system.
    • To increase buffer size using the following command:

      git config --system http.postBuffer 52428800

    I tried this, but no luck. Even tried to increase my buffer size more than 52428800, but still same error.

    Stucked on this issue. Can anyone please suggest me a solution.

    Thank you.