开发者

Github Push Error: RPC failed; result=22, HTTP code = 413

开发者 https://www.devze.com 2023-04-06 10:07 出处:网络
stupid issue with Github going on right now. I have a decent amount of changes (~120MB in size), when I attempt to push, this is what happens:

stupid issue with Github going on right now. I have a decent amount of changes (~120MB in size), when I attempt to push, this is what happens:

error: RPC failed; result=22, HTTP code = 413
fa开发者_开发技巧tal: The remote end hung up unexpectedly 
fatal: The remote end hung up unexpectedly

I've already done

git config http.postBuffer 524288000, so that doesn't seem to be the issue. What could it be?


If you get error 413, then the issue doesn't lie with git but with your web server. It's your web server that is blocking big upload files.

Solution for nginx

Just load your nginx.conf and add client_max_body_size 50m; ( changing the value to your needs ) in the http block.

Reload nginx to accept the new config by executing sudo service nginx reload and try again to push your commit over http.

Solution for Apache

In your httpd.conf add LimitRequestBody 52428800 ( changing the value to your needs ) inside a <Directory /> block. Doing this you can limit the request of the whole server filesystem, just a single Virtual Host or a directory.


I figured it out!!! Of course I would right after I hit post!

I had the repo set to use the HTTPS url, I changed it to the SSH address, and everything resumed working flawlessly.


command to change the remote url ( from https -> git@... ) is something like this

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

origin here is the name of my remote ( do git remote and what comes out is your origin ).


I had the same problem but I was using a reverse proxy.

So I had to set

client_max_body_size 50m; 

inside both configure files :

  • on the gitlab nginx web server (as said inside the previous answers)
  • but also on the nginx reverse proxy hosted on the dedicated server.


If you are facing this issue while pushing changes in big size then run below command in terminal.

git config --global http.postBuffer 157286400

See this for more details.


I already had "HTTPS//" in the git URL yet faced this error.

All I did was to add option -u with push and it worked.

git push -u origin master


For those who use IIS 7 to host a git http/https endpoint:

You need to increase your uploadReadAheadSize.

Launch Internet Information Services (IIS) Manager

  1. Expand the Server field

  2. Expand Sites

  3. Select the site you want to make the modification for.

  4. In the Features section, double click Configuration Editor

  5. Under Section select: system.webServer > serverRuntime

  6. Modify the uploadReadAheadSize section (The value must be between 0 and 2147483647.)

  7. Click Apply

  8. Restart the Website


Do you use https links instead of ssh links? Because the https link is limited by the size of the upload of HttpServer (such as Apache, Ngnix), there is no such restriction when using ssh.

Use the following method to switch to the ssh link.

  1. Open terminal.
  2. Switch to your project's working directory.
  3. Get the name of the remote repository
$ git remote -v
origin  https://github.com/[user_name]/[project_name].git (fetch)
origin  https://github.com/[user_name]/[project_name].git (push)
  1. Modify the git address to ssh link.
git remote set-url origin git@github.com:[user_name]/[project_name].git

If you determine the remote repository name, proceed directly to step 4. Now, you can do the push operation happily.


The error occurs in 'libcurl', which is the underlying protocol for https upload. Solution is to somehow updgrade libcurl. To get more details about the error, set GIT_CURL_VERBOSE=1

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

Meaning of error, as per libcurl doc: CURLE_HTTP_RETURNED_ERROR (22)

This is returned if CURLOPT_FAILONERROR is set TRUE and the HTTP server returns an error code that is >= 400.

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


I got this problem when I try to clone a git repo in Linux machine.

the following URL is working for me in windows

http://swamy@git.swamy.com/scm/project/swamy-main.git

whereas the following URL works in Linux machine and it has https in URL

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


I had this error (error: RPC failed; result=22, HTTP code = 413) when I tried to push my initial commit to a new BitBucket repository. The error occurred for me because the BitBucket repo had no master branch. If you are using SourceTree you can create a master branch on the origin by pressing the Git Flow button.


Need to change remote url to ssh or https

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

or

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

Hope, this will help :)


I had the same issue (on Win XP), I updated the libcurl-4.dll file in my Git bin directory to the SSL version from http://www.paehl.com/open_source/?download=curl_DLL_ONLY.7z (renaming to libcurl4.dll). All working ok now.


https clone of gists fails (ssh works, see below):

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

This works: git clone git@gist.github.com:123456.git


Was facing same issue. In my case it was non-compatible GIT versions across multiple users who are accessing(pull/push) same project.

have just updated GIT version and updated the path on Android studio settings and its working fine for me.

Edit -

Git for Windows (1.9.5) having some problem, updating the same may helps.


Was facing the same issue however it got resolved by cleaning up the git repository (Clean untracked files using "git clean").


when I used the https url to push to the remote master, I met the same proble, I changed it to the SSH address, and everything resumed working flawlessly.


I was able to resolve this issue by increasing the size in the following line nginx['client_max_body_size'] = 'Xm' in the file /etc/gitlab/gitlab.rb

X= your value. The default value is 250.

After updating the file, run the re-configure command gitlab-ctl reconfigure


For those whose changes are not really huge in size and still getting this error. I had the same error error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413 you know what saved the day?

git pull --rebase

There were changes on the remote repo that were not in my local repo and just a simple rebase solved the issue. Talk about misleading error messages.

0

精彩评论

暂无评论...
验证码 换一张
取 消