Wednesday, February 2, 2022

[SOLVED] Git push Error: RPC failed; result=22, HTTP code = 502

Issue

I'm trying to add a large project to GitLab using git and everything except a folder works for me. This folder includes all the media (only jpg and pdf) of the website (5GB).

So if I do a: git add ., It adds everything except this folder. Which I have to add later with: add -f

When I try to push this folder it gives me the following error:

- Via http:

[aritz@localhost html]$ git push -u originhttp master
Username for 'https://gitlab.com': *******
Password for 'https://*******@gitlab.com':
Counting objects: 11006, done.
Compressing objects: 100% (9541/9541), done.
Writing objects: 100% (11003/11003), 2.99 GiB | 7.25 MiB/s, done.
Total 11003 (delta 895), reused 0 (delta 0)
error: RPC failed; result=22, HTTP code = 520
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly
Everything up-to-date

- Via SSH:

[aritz@localhost html]$ git push -u origin master
Counting objects: 11006, done.
Connection to gitlab.com closed by remote host.
fatal: The remote end hung up unexpectedly
Compressing objects: 100% (9541/9541), done.
error: pack-objects died of signal 13
error: failed to push some refs to '[email protected]:****/*********.git'

What I have tried:

- Remove proxy
git config --global --unset http.proxy
git config --global --unset https.proxy

- Add data:
git config --global user.name ""
git config --global user.email ""

- Expand postBuffer:
git config --global http.postBuffer 157286400
git config --global http.postBuffer 524288000

I have also looked at the httpd log but have not seen anything relevant. And the permission of the folder is the same as others files.

Lastly, as an alternative option, I have tried to create an empty repository just for this folder:

In this case I can do the git add . without having to force it. But when I try to push this is the result:

- Via ssh:

[aritz@localhost resources]$ git push -u originssh master
Counting objects: 11086, done.
Connection to gitlab.com closed by remote host.
fatal: The remote end hung up unexpectedly
Compressing objects: 100% (9623/9623), done.
error: pack-objects died of signal 13
error: failed to push some refs to '[email protected]:*****/*********.git'

- Via http:

[aritz@localhost resources]$ git push -u origin master
Username for 'https://gitlab.com': ********
Password for 'https://********@gitlab.com': 
Counting objects: 11086, done.
Compressing objects: 100% (9623/9623), done.
Writing objects: 100% (11086/11086), 2.99 GiB | 5.97 MiB/s, done.
Total 11086 (delta 892), reused 0 (delta 0)
error: RPC failed; result=22, HTTP code = 502
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly
Everything up-to-date

In one of my many attempts I have managed to get it to work, but although I believe I have followed the same steps as before, I cannot get it to work again.


Solution

If the large files are binary files, you could use Git LFS, this would allow to keep the binary files separate from the repository if not required, so users do not have to download the whole repository, with the binary files, and this would save time.

More information on Git LFS on the following webpage, https://docs.gitlab.com/ee/administration/lfs/



Answered By - Shaqil Ismail
Answer Checked By - Gilberto Lyons (WPSolving Admin)