Git - 错误:RPC 失败;result=22, HTTP code = 401 fatal: 远端意外挂断

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12544142/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 14:39:42  来源:igfitidea点击:

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

gitgit-remote

提问by

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.

我正在使用 ubuntu 11.10 机器。我已经安装了 1.7.7.1 版本的 git。我正在使用 git-cola 来推送和拉取我的代码,并且我能够成功提交和推送我的更改。

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).

现在,我已经更换了我的机器,我的新系统具有与上述相同的配置。(Ubuntu 11.10 机器和 git 版本 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:

在新机器上,我在git push上有问题。当我尝试推送代码时收到以下错误消息:

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

  • git 用户密码错误(就我而言,我认为我使用正确的密码来推送代码。因为,即使现在我成功了,当我从旧系统推送工作区代码时(使用相同的密码!)。但是问题仅来自我的新系统。
  • 使用以下命令增加缓冲区大小:

    git 配置 --system http.postBuffer 52428800

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

我试过这个,但没有运气。甚至试图将我的缓冲区大小增加到 52428800 以上,但仍然是同样的错误。

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

卡在这个问题上。任何人都可以请给我建议一个解决方案。

Thank you.

谢谢你。

采纳答案by CharlesB

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

您一定在远程 URL 中犯了错误,请仔细检查输出git remote -v并使用

 git remote set-url origin <new-url>

assuming the remote name is origin

假设远程名称是 origin

回答by shemanov

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

对于在 Windows 上使用 TFS git 存储库的人。我的 Windows 密码最近更改为此我有

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.

在做不同的事情时,比如取、推或拉。我们使用 TFS git repo。我通过控制面板从 Windows 凭据管理器中删除了我的 tfs 密码,解决了这个问题。https://support.microsoft.com/help/4026814/windows-accessing-credential-manager

回答by ITisha

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

更新到 git 版本 1.8.x 后问题立即解决

回答by Gautam Jain

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

就我而言,用户权限是问题所在。我将自己添加为存储库的有效用户,之后“推送”工作。

回答by barfuin

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

FWIW,我遇到了同样的问题,并通过删除并重新添加遥控器来解决它:

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.

这假设您在 master 分支上,而您唯一的远程是origin.

回答by Fred

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.

我有同样的错误,对我来说这是因为我没有存储库的提交权限。401 错误代码是 HTTP 401(未经授权)错误。一旦我获得权限,问题就解决了。

回答by Axle

Make sure your url has the correct username and password

确保您的网址具有正确的用户名和密码

git remote set-url origin http : //username:password..

回答by The Camster

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.

这可能不是您正在寻找的答案,但我的公司代理(悄悄地)提交或其他上传到 github.com 失败。针对 git.com 的所有其他操作都可以正常工作,从而混淆了问题。

The only solution was to create patches and email them out of the network. Kludgey but effective.

唯一的解决方案是创建补丁并将其从网络中发送出去。笨拙但有效。

回答by vicb1

The only thing that worked for me was deleting all ".gitignore" files before committing, because I had a few nested Git roots

唯一对我有用的是在提交之前删除所有“.gitignore”文件,因为我有一些嵌套的 Git 根

Note that I just started fresh with a new repository, so I didn't have to deal with reversing commits

请注意,我刚刚开始使用新的存储库,所以我不必处理反向提交

回答by Saad

I reinstalledgit for my windows 10 machine. And the magic happened !!

我为我的 Windows 10 机器重新安装了git。魔法发生了!!