问题
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.
回答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
回答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 .
回答3:
The problem solved right after update to git version 1.8.x
回答4:
In my case, user permission was the problem. I added myself as a valid user of the repository after which 'Push' worked.
回答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
.
回答6:
I had this same error, for me it was because I didn't have commit permissions for the repository. The 401 error code is the HTTP 401 (Unauthorized) error. Once I got permissions the problem was solved.
回答7:
Make sure your url has the correct username and password
git remote set-url origin http : //username:password..
回答8:
This may not be the answer you are looking for, but my corporate proxy (silently) fails commits or other uploads to github.com. All other operations against git.com work correctly, obfuscating the issue.
The only solution was to create patches and email them out of the network. Kludgey but effective.
回答9:
The only thing that worked for me was deleting all ".gitignore" files before committing, because I had a few nested Git roots
Note that I just started fresh with a new repository, so I didn't have to deal with reversing commits
来源:https://stackoverflow.com/questions/12544142/git-error-rpc-failed-result-22-http-code-401-fatal-the-remote-end-hung-u