Github Push Error: RPC failed; result=22, HTTP code = 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,所以这似乎不是问题。会是什么呢?

如果你得到错误413,那么问题不在于git,而在于你的web服务器。是你的网络服务器阻止了大的上传文件。

nginx解决方案

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

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

Apache的解决方案

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

我想出来! !我当然会在发帖后立即回复!

我将repo设置为使用HTTPS url,我将其更改为SSH地址,一切都恢复了正常工作。

命令修改远程url(从HTTPS -> git@..)。是这样的吗

git remote set-url origin git@github.com:GitUserName/GitRepoName.git

origin这里是我的remote的名字(执行git remote,输出的就是你的origin)。

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

所以我必须设置

client_max_body_size 50m; 

在配置文件中:

  • 在gitlab nginx web服务器上(正如前面的答案中所说)
  • 但也在nginx反向代理托管在专用服务器上

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

git config --global http.postBuffer 157286400

查看更多细节。

我在git URL中已经有"HTTPS//"了,但是出现了这个错误。

我所做的就是添加选项-u与push和它工作。

git push -u origin master

对于使用IIS 7托管git http/https端点的用户:

你需要增加你的uploadReadAheadSize

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

  1. 展开Server字段

  2. 扩大网站

  3. 选择要修改的站点

  4. 在Features部分,双击Configuration Editor

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

  6. 修改uploadReadAheadSize部分(必须在02147483647之间)

  7. 点击适用

  8. 重新启动网站

您使用https链接而不是ssh链接吗?因为https链接受到HttpServer(如Apache, Ngnix)上传大小的限制,所以在使用ssh时没有这样的限制。

使用如下方法切换到ssh链接:

  1. 打开终端。
  2. 切换到项目的工作目录
  3. 获取远程存储库的名称
$ git remote -v
origin  https://github.com/[user_name]/[project_name].git (fetch)
origin  https://github.com/[user_name]/[project_name].git (push)
  • 修改git地址为ssh link
  • git remote set-url origin git@github.com:[user_name]/[project_name].git
    

    如果远程存储库名称已确定,请直接执行步骤4。现在,您可以愉快地执行push操作了。

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

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

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

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

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

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

    下面的URL在windows

    中为我工作
    http://swamy@git.swamy.com/scm/project/swamy-main.git
    

    而下面的URL在Linux机器上工作并且URL

    中有https
    https://swamy@git.swamy.com/scm/project/swamy-main.git
    

    我有这个错误(错误:RPC失败;result=22, HTTP code = 413),当我试图将我的初始提交推送到一个新的BitBucket存储库时。发生错误是因为BitBucket repo有没有主分支。如果你正在使用SourceTree,你可以通过按Git Flow按钮在源上创建一个主分支。

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

    git remote set-url origin git@github.com:laravel/laravel.git
    

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

    希望,这将有助于:)

    我有同样的问题(在Win XP上),我更新了libcurl-4.dll文件在我的Git bin目录下的SSL版本从http://www.paehl.com/open_source/?download=curl_DLL_ONLY.7z(重命名为libcurl4.dll)。

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

    12:00 jean@laptop:~/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 git@gist.github.com:123456.git

    面临同样的问题。在我的情况下,它是不兼容的GIT版本跨多个用户访问(拉/推)同一个项目。

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

    编辑

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

    也面临同样的问题,但是通过清理git存储库(使用"git Clean "清理未跟踪的文件)解决了这个问题。

    当我使用https url推送到远程主机时,我遇到了同样的问题,我将其更改为SSH地址,一切都恢复正常工作。

    我能够通过在/etc/gitlab/gitlab.rb文件中增加以下行nginx['client_max_body_size'] = 'Xm'来解决这个问题

    X=您的值。默认值为250。

    更新文件后,运行重新配置命令gitlab-ctl reconfigure

    对于那些更改的大小不是很大但仍然得到此错误的人。我也犯了同样的错误error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413你知道是什么拯救了我们吗?

    git pull --rebase

    在远程repo上有一些变化,这些变化不在我的本地repo中,只是一个简单的rebase解决了这个问题。谈论误导性错误消息。

    如果您使用http连接,请将http配置设置为1.1。

    git config http.version HTTP/1.1

    最新更新