it-swarm.cn

Github推送错误:RPC失败; result = 22,HTTP代码= 413

github正在进行的愚蠢问题。我有大量的更改(大小约为120MB),当我尝试推送时,会发生以下情况:

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

我已经完成了

git config http.postBuffer 524288000,所以这似乎不是问题。会是什么呢?

114
Sneakyness

我想到了!!!当然我会在发帖后立即行动!

我将repo设置为使用HTTPS URL,我将其更改为SSH地址,一切恢复正常运行。

53
Sneakyness

如果您收到错误413,那么问题不在于git,而在于 与您的Web服务器 。这是您的Web服务器阻止大型上传文件。

Nginx的解决方案

只需加载nginx.conf并在http块中添加client_max_body_size 50m;(根据需要更改值)。

通过执行Sudo service nginx reload重新加载nginx以接受新配置,然后再次尝试通过http推送您的提交。

Apache的解决方案

在你的httpd.conf中,在LimitRequestBody 52428800块中添加<Directory />(根据需要更改值)。这样做可以限制整个服务器文件系统的请求,只需一个虚拟主机或目录。

我希望这有帮助。

189
Tinou

更改远程URL的命令(来自https - > git @ ...)是这样的

git remote set-url Origin [email protected]:GitUserName/GitRepoName.git

这里的原点是我的遥控器的名称(做git遥控器,出来的是你的Origin)。

36
kay am see

我有同样的问题,但我使用的是反向代理。

所以我必须设置

client_max_body_size 50m; 

在两个配置文件中:

  • 在gitlab nginx Web服务器上(如前面的答案所述)
  • 但也在专用服务器上托管的nginx反向代理上。
7
grimabe

我已经在git URL中有“HTTPS //”但是遇到了这个错误。

我所做的就是用Push添加选项-u并且它有效。

git Push -u Origin master

6
Jayzcode

对于那些使用IIS 7来托管git http/https端点的人:

你需要增加你的uploadReadAheadSize

启动Internet信息服务(IIS)管理器

  1. 展开“服务器”字段

  2. 展开网站

  3. 选择要对其进行修改的站点。

  4. 在“功能”部分中,双击Configuration Editor

  5. Section下选择:system.webServer > serverRuntime

  6. 修改uploadReadAheadSize部分(该值必须介于02147483647之间。)

  7. 点击 Apply

  8. 重启网站

4
Markus Mauch

如果您在推送大尺寸的更改时遇到此问题,请在终端中运行以下命令。

git config --global http.postBuffer 157286400

有关详细信息,请参阅 this

2
vitthal

当我尝试将我的初始提交推送到新的BitBucket存储库时,我遇到了这个错误( 错误:RPC失败;结果= 22,HTTP代码= 413 )。这个错误发生在我身上,因为BitBucket repo有 没有master branch。如果您正在使用 SourceTree 您可以通过按 Git Flow按钮 在Origin上创建一个主分支。

1
Ben

当我尝试在Linux机器上克隆git repo时遇到了这个问题。

以下URL在Windows中适用于我

http://[email protected]/scm/project/swamy-main.git

而以下URL在Linux机器上工作,并且在URL中有https

https://[email protected]/scm/project/swamy-main.git
1
Swamy

https克隆的gists失败(ssh工作,见下文):

12:00 [email protected]:~/tmp$ GIT_CURL_VERBOSE=1 git clone https://Gist.github.com/123456.git username
Initialized empty Git repository in /home/jean/tmp/username/.git/
* Couldn't find Host Gist.github.com in the .netrc file; using defaults
* About to connect() to Gist.github.com port 443 (#0)
*   Trying 192.30.252.142... * Connected to Gist.github.com (192.30.252.142) port 443 (#0)
* found 141 certificates in /etc/ssl/certs/ca-certificates.crt
*        server certificate verification OK
*        common name: *.github.com (matched)
*        server certificate expiration date OK
*        server certificate activation date OK
*        certificate public key: RSA
*        certificate version: #3
*        subject: C=US,ST=California,L=San Francisco,O=GitHub\, Inc.,CN=*.github.com
*        start date: Mon, 30 Apr 2012 00:00:00 GMT
*        expire date: Wed, 09 Jul 2014 12:00:00 GMT
*        issuer: C=US,O=DigiCert Inc,OU=www.digicert.com,CN=DigiCert High Assurance CA-3
*        compression: NULL
*        cipher: ARCFOUR-128
*        MAC: SHA1
> GET /123456.git/info/refs?service=git-upload-pack HTTP/1.1
User-Agent: git/1.7.1
Host: Gist.github.com
Accept: */*
Pragma: no-cache

< HTTP/1.1 301 Moved Permanently
< Server: GitHub.com
< Date: Fri, 01 Nov 2013 05:00:51 GMT
< Content-Type: text/html
< Content-Length: 178
< Location: https://Gist.github.com/Gist/123456.git/info/refs?service=git-upload-pack
< Vary: Accept-Encoding
<
* Ignoring the response-body
* Expire cleared
* Connection #0 to Host Gist.github.com left intact
* Issue another request to this URL: 'https://Gist.github.com/Gist/123456.git/info/refs?service=git-upload-pack'
* Couldn't find Host Gist.github.com in the .netrc file; using defaults
* Re-using existing connection! (#0) with Host Gist.github.com
* Connected to Gist.github.com (192.30.252.142) port 443 (#0)
> GET /Gist/123456.git/info/refs?service=git-upload-pack HTTP/1.1
User-Agent: git/1.7.1
Host: Gist.github.com
Accept: */*
Pragma: no-cache

< HTTP/1.1 200 OK
< Server: GitHub.com
< Date: Fri, 01 Nov 2013 05:00:52 GMT
< Content-Type: application/x-git-upload-pack-advertisement
< Transfer-Encoding: chunked
< Expires: Fri, 01 Jan 1980 00:00:00 GMT
< Pragma: no-cache
< Cache-Control: no-cache, max-age=0, must-revalidate
< Vary: Accept-Encoding
<
* Connection #0 to Host Gist.github.com left intact
* Couldn't find Host Gist.github.com in the .netrc file; using defaults
* About to connect() to Gist.github.com port 443 (#0)
*   Trying 192.30.252.142... * connected
* Connected to Gist.github.com (192.30.252.142) port 443 (#0)
* found 141 certificates in /etc/ssl/certs/ca-certificates.crt
* SSL re-using session ID
*        server certificate verification OK
*        common name: *.github.com (matched)
*        server certificate expiration date OK
*        server certificate activation date OK
*        certificate public key: RSA
*        certificate version: #3
*        subject: C=US,ST=California,L=San Francisco,O=GitHub\, Inc.,CN=*.github.com
*        start date: Mon, 30 Apr 2012 00:00:00 GMT
*        expire date: Wed, 09 Jul 2014 12:00:00 GMT
*        issuer: C=US,O=DigiCert Inc,OU=www.digicert.com,CN=DigiCert High Assurance CA-3
*        compression: NULL
*        cipher: ARCFOUR-128
*        MAC: SHA1
> POST /123456.git/git-upload-pack HTTP/1.1
User-Agent: git/1.7.1
Host: Gist.github.com
Accept-Encoding: deflate, gzip
Content-Type: application/x-git-upload-pack-request
Accept: application/x-git-upload-pack-result
Content-Length: 116

< HTTP/1.1 301 Moved Permanently
< Server: GitHub.com
< Date: Fri, 01 Nov 2013 05:00:53 GMT
< Content-Type: text/html
< Content-Length: 178
< Location: https://Gist.github.com/Gist/123456.git/git-upload-pack
< Vary: Accept-Encoding
<
* Ignoring the response-body
* Connection #0 to Host Gist.github.com left intact
* Issue another request to this URL: 'https://Gist.github.com/Gist/123456.git/git-upload-pack'
* Violate RFC 2616/10.3.2 and switch from POST to GET
* Couldn't find Host Gist.github.com in the .netrc file; using defaults
* Re-using existing connection! (#0) with Host Gist.github.com
* Connected to Gist.github.com (192.30.252.142) port 443 (#0)
> GET /Gist/123456.git/git-upload-pack HTTP/1.1
User-Agent: git/1.7.1
Host: Gist.github.com
Accept-Encoding: deflate, gzip
Content-Type: application/x-git-upload-pack-request
Accept: application/x-git-upload-pack-result

* The requested URL returned error: 400
* Closing connection #0
error: RPC failed; result=22, HTTP code = 400

这有效:git clone [email protected]:123456.git

1
Jean Jordaan

面临同样的问题。在我的例子中,它是访问(拉/推)相同项目的多个用户的不兼容的GIT版本。

刚刚更新了GIT版本并更新了Android studio设置的路径,并且它对我来说工作正常。

编辑 -

Git for Windows(1.9.5)有一些问题,更新相同可能会有所帮助。

0
Vishal

错误发生在'libcurl'中,这是https上传的基础协议。解决方案是以某种方式升级libcurl。要获取有关错误的更多详细信息,请设置GIT_CURL_VERBOSE = 1

https://confluence.atlassian.com/pages/viewpage.action?pageId=306348908

错误的含义,根据libcurl doc:CURLE_HTTP_RETURNED_ERROR(22)

如果CURLOPT_FAILONERROR设置为TRUE且HTTP服务器返回> = 400的错误代码,则返回此值。

http://curl.haxx.se/libcurl/c/libcurl-errors.html

0
FractalSpace

面对同样的问题但是通过清理git存储库解决了这个问题(使用“git clean”清理未跟踪的文件)。

0
Darpan

我遇到了同样的问题(在Win XP上),我将我的Git bin目录中的libcurl-4.dll文件更新为来自 http://www.paehl.com/open_source/?download=curl_DLL_ONLY的SSL版本。 7z (重命名为libcurl4.dll)。现在一切正常。

0
Angus Morgan

需要将远程URL更改为 ssh 或https

git remote set-url Origin [email protected]:laravel/laravel.git

要么

git remote set-url Origin https://github.com/laravel/laravel.git

希望,这会有所帮助:)

0
Vikash