我正在OSX上使用SourceTree,并使用Git推送到Visual Studio Online。 我收到以下错误:
POST git-receive-pack(490857233个字节)
错误:RPC失败; result = 22,HTTP代码= 404
致命错误:远程端意外挂断
一切都是最新的
完成带有错误,请参见上文
我已经尝试过以下方法:
git config --global http.postBuffer 524288000
我正在OSX上使用SourceTree,并使用Git推送到Visual Studio Online。 我收到以下错误:
POST git-receive-pack(490857233个字节)
错误:RPC失败; result = 22,HTTP代码= 404
致命错误:远程端意外挂断
一切都是最新的
完成带有错误,请参见上文
我已经尝试过以下方法:
git config --global http.postBuffer 524288000
我遇到了一个非常类似的错误(这个答案是谷歌搜索结果中排名最高的),解决方法是由@Liviu Chircu在评论中提供的。
解决方法是在URL末尾添加.git
。
git clone http://myURL/projectname
Cloning into 'projectname'...
error: RPC failed; result=22, HTTP code = 404
fatal: The remote end hung up unexpectedly
然而:
git clone http://myURL/projectname.git
成功了。
奇怪的是,在两台Linux机器和一台Windows桌面上,没有.git
的原始URL都成功了,但在第三台Linux机器上失败了。包含.git
可以让它在所有的机器上工作。
git config --global http.postBuffer 524288000
不起作用。 - jdhao.git
解决了我的问题。 - shogitai我刚刚在克隆时,在 Git 的 URL 末尾添加了 .git ,成功了。
您的仓库可能太大了,尝试分块上传,例如使用GIT在历史记录中回滚一半或者更多,在新分支上推送它,然后再推送最新的提交。
可能有更好的解决方法,但这是我能够快速解决问题的方法。
我能够推送108.61 MiB,但无法推送144.64 MiB。
希望这可以帮到您。
如果您能够使用SSH身份验证,我建议您切换到该方式,因为这应该可以完全避免这个问题。(请注意,您可以在同一台机器上同时使用HTTPS和SSH,即使如此。)目前对于Team Services Git仓库的SSH身份验证处于私有预览状态。
原始帖子:
正如@Oxymoron所述,问题在于您的存储库太大,或者更具体地说,您正在尝试一次推送过多内容。
什么?那不合理!这不是
HTTP 404
代码的作用!
对我来说也没有意义。*瞪着微软的方向*
您可能已经遇到了这个问题,并收到了类似以下错误消息:
Unable to rewind rpc post data - try increasing http.postBuffer
确定每次推送多少个提交。通常建议使用二分查找来确定可以推送的数量,但由于推送之间的等待时间可能很长,这可能会很困难。此外,许多仓库有一个非常大的第一次提交,或者在那之后的某些提交非常大。如果您知道这样的提交,请尝试单独推送它们。如果您的仓库足够小,最好只推送一个提交。否则,尝试推送20-30个提交,如果遇到问题,则减少数量。
假设您只有一个分支master
,请在同一位置创建一个新分支,例如master-temp
。
将master
重置为要推送的第一组中的最后一个提交。例如:git reset --hard master-temp~100
。
推送该提交(git push
)。
在下一组的最后一个提交处进行--ff
合并。(git merge --ff-only master-temp~90
)
重复步骤4和5,直到所有提交都被推送。
$ git log --oneline --decorate
* fffffff (HEAD -> master) Commit six
* eeeeeee Commit five
* ddddddd Commit four
* ccccccc Commit three
* bbbbbbb Commit two
* aaaaaaa Commit one
$ git checkout -b master-temp master
$ git checkout master
$ git reset --hard aaaaaaa
$ git push origin master
$ git merge --ff-only bbbbbbb
$ git push origin master
$ git merge --ff-only ccccccc
$ git push origin master
$ git merge --ff-only ddddddd
$ git push origin master
$ git merge --ff-only eeeeeee
$ git push origin master
$ git merge --ff-only fffffff
$ git push origin master
别担心,完成后您仍将获得原始历史记录。但我不想重写我的历史!我的 Git 日志很干净,因为我花了很多时间学习如何编写出色的提交消息,并且我总是保持我的提交原子性。
* fffffff (HEAD -> master) Tiny commit five
* eeeeeee Tiny commit four
* ddddddd Tiny commit three
* ccccccc Tiny commit two
* bbbbbbb Tiny commit one
* aaaaaaa This commit is massive
git rebase -i
)以将大型提交拆分为几个较小的提交。)$ git checkout -b master-temp master
$ git rebase -i --root
--root
。否则,请使用例如git rebase -i bbbbbbb
。pick
更改为edit
。$ git reset HEAD^
$ git add somefiles
$ git commit
$ git push origin master-temp
$ git add someotherfiles
$ git commit
$ git push origin master-temp
$ git rebase --continue
$ git push origin master-temp
$ git checkout master
switched to branch 'master'
$ git push origin master
POST git-receive-packed (chunked)
remote: Analyzing objects... (1212/1212) (2518523 ms)
remote: Storing packfile... done (48186 ms)
remote: Storing index... done (228 ms)
Pushing to https://example.visualstudio.com/SomeCollection/SomeTeam/_git/MyRepo
To https://example.visualstudio.com/SomeCollection/SomeTeam/_git/MyRepo
* [new branch] master -> master
updating local tracking ref 'refs/remotes/origin/master'
分析对象
步骤是最耗时的步骤。这是Git计算可以重复使用多少内容以及需要上传多少内容。)如果您想了解更多关于这是如何工作的,请查看Git内部文档中的Packfiles章节,也许在Git对象方面进行了解之后再查看。
https://.../foo
而不是https://.../foo.git
,我遇到了类似的错误。 - Liviu Chircu