413 ошибка git

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

Когда пушу изменения вылезает такая ошибка
6435986dc561b570588521.png
Подскажите, как можно решить проблему?

error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413
send-pack: unexpected disconnect while reading sideband packet
fatal: the remote end hung up unexpectedly
Everything up-to-date


  • Вопрос задан

    11 апр.

  • 192 просмотра

Пригласить эксперта

HTTP Error 413 — Content Too Large

Это не у гита косяк, а у вашего вебсервера у которого лимит на размер заливаемых файлов.
Настройте параметр client_max_body_size в nginx, или LimitRequestBody если у вас apache.
(не забудьте перезапустить вебсервер или перечитать конфиг на горячую).

Либо переключите git с https на SSH, тогда вебсервер не повлияет.


  • Показать ещё
    Загружается…

07 июн. 2023, в 01:32

5000 руб./за проект

07 июн. 2023, в 00:54

15000 руб./за проект

07 июн. 2023, в 00:51

13000 руб./за проект

Минуточку внимания

The error «RPC failed; result=22, HTTP code = 413» is a common issue faced by Github users when pushing changes to a remote repository. This error message indicates that the request to push the changes is too large and the Github server is unable to handle it. In this case, the server returns a 413 HTTP status code, which means «Request Entity Too Large».

Method 1: Reduce the size of the repository

To fix the Github Push Error: RPC failed; result=22, HTTP code = 413, you can reduce the size of the repository. Here are the steps to do it:

  1. Identify the large files in your repository using the following command:
git rev-list --objects --all | git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | awk '/^blob/ {print substr($0,6)}' | sort --numeric-sort --key=2 | cut --complement --characters=13-40 --stable | gnumfmt --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest
  1. Once you have identified the large files, you can remove them from the repository using the following command:
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch <path-to-large-file>' --prune-empty --tag-name-filter cat -- --all
  1. After removing the large files, you can run the following command to compress the repository:
git gc --aggressive --prune=now
  1. Finally, force push the changes to the remote repository using the following command:
git push --force origin <branch-name>

By following these steps, you should be able to fix the Github Push Error: RPC failed; result=22, HTTP code = 413.

Method 2: Increase the HTTP post buffer size

To fix the Github Push Error: RPC failed; result=22, HTTP code = 413, you can increase the HTTP post buffer size by following these steps:

  1. Open Git Bash or Terminal.
  2. Navigate to your Git repository.
  3. Run the following command to increase the buffer size:
git config http.postBuffer 524288000

This command sets the buffer size to 500MB, but you can adjust the size to your preference.

  1. Try pushing your changes to Github again.

If the error persists, you can try increasing the buffer size further.

git config http.postBuffer 1048576000

This command sets the buffer size to 1GB.

  1. Try pushing your changes to Github again.

If the error still persists, you may need to contact Github support for further assistance.

Note: Increasing the buffer size may not always solve the issue, as it could be caused by other factors such as network connectivity or server issues.

I hope this helps you resolve your Github Push Error: RPC failed; result=22, HTTP code = 413 issue.

Method 3: Use Git Large File Storage (LFS)

If you encounter the Github Push Error: RPC failed; result=22, HTTP code = 413 when pushing large files to Github, you can solve this issue by using Git Large File Storage (LFS).

Step 1: Install Git LFS

First, you need to install Git LFS on your local machine. You can download and install it from the official Git LFS website or use your operating system’s package manager.

Step 2: Initialize Git LFS

Once you have installed Git LFS, you need to initialize it in your Git repository. Run the following command in your repository directory:

This will set up Git LFS for your repository.

Step 3: Track large files with Git LFS

Next, you need to track the large files in your repository with Git LFS. Run the following command to track all files with a .pdf extension:

This will create a .gitattributes file in your repository that tells Git LFS which files to track.

Step 4: Commit and push changes

Commit the .gitattributes file and the large files you want to push to Github:

git add .gitattributes large_file.pdf
git commit -m "Add large_file.pdf and .gitattributes"

Then push the changes to Github:

Step 5: Verify Git LFS usage

You can verify that Git LFS is being used for your large files by running the following command:

This will list all the files that are being tracked by Git LFS.

That’s it! By using Git LFS, you can push large files to Github without encountering the Github Push Error: RPC failed; result=22, HTTP code = 413.

Method 4: Split the large repository into smaller ones

If you are encountering the Github push error with RPC failed and result=22, HTTP code = 413, it may be due to the large size of your repository. To fix this issue, you can split the large repository into smaller ones. Here is how you can do it:

Step 1: Clone the Large Repository

First, clone the large repository to your local machine using the following command:

git clone https://github.com/username/repo.git

Step 2: Create a New Repository

Create a new repository on Github for each subdirectory you want to split from the large repository.

Step 3: Split the Large Repository

To split the large repository into smaller ones, use the following commands:

git filter-branch --prune-empty --subdirectory-filter path/to/directory -- --all

This command will create a new branch with only the files and history of the specified subdirectory.

Step 4: Push the New Repository

Now, push the new repository to Github using the following commands:

git remote add newrepo https://github.com/username/newrepo.git
git push newrepo branchname

Replace «newrepo» with the name of the new repository you created in Step 2, and «branchname» with the name of the branch you created in Step 3.

Step 5: Repeat for Other Subdirectories

Repeat Steps 3 and 4 for each subdirectory you want to split from the large repository.

Problem

Pushing attempt with Git LFS results in when cloning, pushing or pulling/fetching, the client may fail like so:

$ git push origin master # using SSH
Git LFS: (186 of 187 files, 4 skipped) 268.25 MB / 448.34 MB, 17.66 MB skipped
Client error: https://your.bitbucket.com/rest/git-lfs/storage/proj/repo/84c72136e4d22c2c42819d902b4400a9cf73f2b04fd6f9f8666739c3bc0a0f79 from HTTP 413
Client error: https://your.bitbucket.com/rest/git-lfs/storage/proj/repo/1c9335681f70363edeb00820ef394fac66125856cca0c3c8cf2c66636739f277 from HTTP 413
Client error: https://your.bitbucket.com/rest/git-lfs/storage/proj/repo/e79f7abda0ba90f2be4e613f78d1ecb7344970711106fe80d0028106f97f613c from HTTP 413
error: failed to push some refs to 'ssh://git@your.bitbucket.com:7999/proj/repo.git'

Cause

This indicates the repository does not have LFS enabled. A user with REPO_ADMIN permissions is able to enable LFS support.

Analysis

The following come up on different logs:

atlassian-bitbucket.log

2016-02-02 14:03:12,626 INFO [NioProcessor-8] c.a.b.i.s.s.SelfClosingChannelSession Executing command: git-receive-pack '/proj/repo.git' 

atlassian-bitbucket-access.log

192.168.1.10 | ssh | i@1PQD53Ux843x157553x0 | user | 2016-02-02 14:03:12,626 | SSH - git-receive-pack '/proj/repo.git' | - | - | - | - | - | - | os4we8 |

atlassian-bitbucket.log

2016-02-02 14:03:13,050 INFO [NioProcessor-9] c.a.b.i.s.s.SelfClosingChannelSession Executing command: git-lfs-authenticate proj/repo.git upload

atlassian-bitbucket-access.log

192.168.1.10 | ssh | i@1PQD53Ux843x157554x1 | user | 2016-02-02 14:03:13,050 | SSH - git-lfs-authenticate proj/repo.git upload | - | - | - | - | - | - | 6pp10j |
192.168.1.10 | ssh | o@1PQD53Ux843x157554x1 | user | 2016-02-02 14:03:13,067 | SSH - git-lfs-authenticate proj/repo.git upload | - | 0 | 0 | 552 | ssh:user:id:1 | 17 | 6pp10j |
192.168.1.10,127.0.0.1 | https | i@1PQD53Ux843x157555x1 | - | 2016-02-02 14:03:13,575 | "POST /scm/proj/repo.git/info/lfs/objects/batch HTTP/1.0" | "" "git-lfs/1.1.0 (GitHub; darwin amd64; go 1.5.1)" | - | - | - | - | - | - |
192.168.1.10,127.0.0.1 | https | o@1PQD53Ux843x157555x1 | user | 2016-02-02 14:03:13,669 | "POST /scm/proj/repo.git/info/lfs/objects/batch HTTP/1.0" | "" "git-lfs/1.1.0 (GitHub; darwin amd64; go 1.5.1)" | 200 | 8907 | 12064 | - | 94 | 1d9nj3u |

nginx

2016/02/02 14:00:46 [error] 16062#0: *1224429 client intended to send too large body: 21693741 bytes, client: 4.3.2.1, server: stash.example.com, request: "PUT /rest/git-lfs/storage/MAIN/repo/e79f7abda0ba90f2be4e613f78d1ecb7344970711106fe80d0028106f97f613c HTTP/1.1", host: "stash.example.com"

In addition…

You can run a Git DEBUG. On the example we saw, the response by nginx was saying «too-large header».

$ GIT_TRACE=1 git push
14:44:49.161648 git.c:348 trace: built-in: git 'push'
...
trace git-lfs: tq: starting 3 transfer workers
trace git-lfs: tq: running as batched queue, batch size of 100
trace git-lfs: tq: sending batch of size 4
...
trace git-lfs: api: batch 4 files
trace git-lfs: HTTP: POST https://stash.example.com/scm/main/repo.git/info/lfs/objects/batch
trace git-lfs: HTTP: 200
trace git-lfs: HTTP: {"objects":[{"oid":"1bd91c03...62dbaa79","size":2746892,"actions":{}},{"oid":"58ef47926...70bb6ea89c","size":10639089,"actions":{}},{"oid":"2631c0...c6f6be538","size":2890471,"actions":{}},{"oid":"84c721...bc0a0f79","size":72016893,"actions":{"upload":{"href":"https://stash.example.com/rest/git-lfs/storage/MAIN/repo/84c72136
trace git-lfs: HTTP: e4d22c2...c0a0f79","header":{"Authorization":"JWT eyJ0e...NzA0NW
trace git-lfs: HTTP: IwOD...ifYKU"}}}}]}
trace git-lfs: HTTP:
Git LFS: (0 of 4 files, 3 skipped) 0 B / 84.20 MB, 15.52 MB skipped trace git-lfs: HTTP: PUT https://stash.example.com/rest/git-lfs/storage/MAIN/repo/84c72136e4...9c3bc0a0f79
trace git-lfs: HTTP: 413
trace git-lfs: HTTP: <html>
<head><title>413 Request Entity Too Large</title></head>
<body bgcolor="white">
<center><h1>413 Request Entity Too Large</h1></center>
<hr><center>nginx/1.9.3 (Ubuntu)</center>
</body>
</html>
...
Git LFS: (2 of 4 files, 3 skipped) 262.52 KB / 84.20 MB, 15.52 MB skipped
Client error: https://stash.example.com/rest/git-lfs/storage/MAIN/repo/84c7213...a0f79 from HTTP 413
error: failed to push some refs to 'ssh://git@stash.example.com:7999/main/repo.git'
$

Resolution

  • This usually happens if you have a reverse proxy that does not allow a header that is too big. Please configure your HTTP proxy correctly.
  • The fix for nginx is to add/modify this server setting for the relevant vhost pointing to bitbucket server, modified for the maximum size of file you intend to store via git-lfs:

    client_max_body_size 256M;

Even if you perform Git LFS operations over SSH, they are actually done of HTTPS.

1. Error Messages:

execute git push http://git.xxx.com/app/guanghe-app.git –all reward

Error Messages:
error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413
fatal: the remote end hung up unexpectedly
fatal: the remote end hung up unexpectedly
Everything up-to-date

The above problem is caused by the size limitation of HTTP push files. Just submit them in SSH.

2. Upload via SSH

git push ssh://git @10.1.8.121:1122/app/guanghe-app.git –all

Enumerating objects: 15951, done.
Counting objects: 100% (15951/15951), done.
Delta compression using up to 6 threads
Compressing objects: 100% (2863/2863), done.
Writing objects: 100% (15951/15951), 35.04 MiB | 23.89 MiB/s, done.
Total 15951 (delta 12568), reused 15905 (delta 12533)
remote: Resolving deltas: 100% (12568/12568), done.
To ssh://10.1.8.151:1122/app/guanghe-app.git
 * [new branch]      dev -> dev

The warehouse has been uploaded successfully

Read More:

Понравилась статья? Поделить с друзьями:
  • 404 произошла ошибка гугл диск
  • 4030 ошибка bmw
  • 4 pda ошибка при запросе адреса
  • 3ff0 ошибка бмв n47
  • 3ff0 ошибка bmw