The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,839 other subscribers

A lot of GitLab pages links and Git pushing a relatively large commit to GitLab: “error: RPC failed; HTTP 502 curl 22 The requested URL returned error: 502”

Posted by jpluimers on 2026/05/27

Got an error when pushing a relatively large commit to GitLab: error: RPC failed; HTTP 502 curl 22 The requested URL returned error: 502

There was no big difference in information between these commands¹:

  1. git push
  2. git push --verbose

Looking at the links below, this might fail for other hosts than GitLab as well.

I needed to fix or work around the above error to get [Wayback/Archive] Folder contents of the Apple Cork & Cupertino Archive by Karl Grabe up and running.

Solutions

  1. break up the commit into smaller portions (this will re-break when combining commits)
  2. use a larger buffer and disable compression

I opted to start with solution 2. which I found via the links below and comes down to either locally or globally setting the buffer size. I opted for the local solution of increasing http.postBuffer  which failed with the same error:

$ git config --local http.postBuffer 1048576000
$ git push --verbose
Pushing to https://gitlab.com/wier1/public/web/sites/gitlab.io/apple-cork-cupertino-arhive-folders.git
Enumerating objects: 429, done.
Counting objects: 100% (429/429), done.
Delta compression using up to 8 threads
Compressing objects: 100% (428/428), done.
Writing objects: 100% (428/428), 681.08 MiB | 27.42 MiB/s, done.
Total 428 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
POST git-receive-pack (714159632 bytes)
error: RPC failed; HTTP 502 curl 22 The requested URL returned error: 502
send-pack: unexpected disconnect while reading sideband packet
fatal: the remote end hung up unexpectedly
Everything up-to-date
$ git config --local core.compression 0
$ git push --verbose
Pushing to https://gitlab.com/wier1/public/web/sites/gitlab.io/apple-cork-cupertino-arhive-folders.git
Enumerating objects: 429, done.
Counting objects: 100% (429/429), done.
Delta compression using up to 8 threads
Compressing objects: 100% (428/428), done.
Writing objects: 100% (428/428), 687.45 MiB | 133.86 MiB/s, done.
Total 428 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
POST git-receive-pack (720847947 bytes)
error: RPC failed; HTTP 502 curl 22 The requested URL returned error: 502
send-pack: unexpected disconnect while reading sideband packet
fatal: the remote end hung up unexpectedly
Everything up-to-date
$ git config --local http.maxRequestBuffer 1048576000
$ git push --verbose
Pushing to https://gitlab.com/wier1/public/web/sites/gitlab.io/apple-cork-cupertino-arhive-folders.git
Enumerating objects: 429, done.
Counting objects: 100% (429/429), done.
Delta compression using up to 8 threads
Compressing objects: 100% (428/428), done.
Writing objects: 100% (428/428), 687.45 MiB | 128.32 MiB/s, done.
Total 428 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
POST git-receive-pack (720847947 bytes)
error: RPC failed; HTTP 502 curl 22 The requested URL returned error: 502
send-pack: unexpected disconnect while reading sideband packet
fatal: the remote end hung up unexpectedly
Everything up-to-date

Those options didn’t work, so then I opted for doing smaller commits, which worked (shipped intermediate output):

$ git add Apple\ folders/apple\ 2gs/2gs\ PVT/
$ git status
$ git push --verbose
$ git add Apple\ folders/apple\ 2gs/Columbia\ EDR\ 1985.06.03/
$ git status
$ git push --verbose
$ git add Apple\ folders/apple\ 2gs/Diagnostics/badge
$ git status
$ git push --verbose
$ git add Apple\ folders/apple\ 2gs/Diagnostics/documentation/*png
$ git status
$ git push --verbose
$ git add Apple\ folders/apple\ 2gs/Diagnostics/ROM\ source/ROM\ Listing/00*
$ git status
$ git push --verbose
$ git add Apple\ folders/apple\ 2gs/Diagnostics/ROM\ source/ROM\ Listing/01*
$ git status
$ git push --verbose
$ git add Apple\ folders/apple\ 2gs/Diagnostics/ROM\ source/ROM\ Listing/02*
$ git status
$ git push --verbose
$ git add Apple\ folders/apple\ 2gs/Diagnostics/ROM\ source/ROM\ Listing/03*
$ git status
$ git push --verbose
$ git add Apple\ folders/apple\ 2gs/Diagnostics/ROM\ source/ROM\ Listing/04*
$ git status
$ git push --verbose
$ git add Apple\ folders/apple\ 2gs/Diagnostics/ROM\ source/ROM\ Listing/05*
$ git status
$ git push --verbose
$ git add Apple\ folders/apple\ 2gs/Diagnostics/ROM\ source/ROM\ Listing/06*
$ git status
$ git push --verbose
$ git add Apple\ folders/apple\ 2gs/Diagnostics/ROM\ source/ROM\ Listing/07*
$ git status
$ git push --verbose
$ git add Apple\ folders/apple\ 2gs/Diagnostics/ROM\ source/ROM\ Listing/08*
$ git status
$ git push --verbose
$ git add Apple\ folders/apple\ 2gs/Diagnostics/ROM\ source/ROM\ Listing/09*
$ git status
$ git push --verbose
$ git add Apple\ folders/apple\ 2gs/Diagnostics/ROM\ source/ROM\ Listing/10*
$ git status
$ git push --verbose
$ git add Apple\ folders/apple\ 2gs/Diagnostics/ROM\ source/2*
$ git status
$ git push --verbose
$ git add Apple\ folders/apple\ 2gs/Mike\ Collins\ Tester/
$ git status
$ git push --verbose
$ git add Apple\ folders/apple\ 2gs/Picture\ frame/
$ git status
$ git push --verbose
$ git add Apple\ folders/Apple\ Cork\ 1983-1998/
$ git status
$ git push --verbose
$ git add Apple\ folders/apple\ goodies/
$ git status
$ git push --verbose
$ git add Apple\ folders/inside\ mac\ promo\ 1984-85/
$ git status
$ git push --verbose
$ find . -iname thumbs.db -delete
$ git add Apple\ folders/Misc\ Apple\ \]\[\ III\ cards\ 1980s/3.5\ Disk\ Drive/
$ git status
$ git push --verbose
$ git add Apple\ folders/Misc\ Apple\ \]\[\ III\ cards\ 1980s/Apple\ 3\ Profile\ Card/
$ git status
$ git push --verbose
$ git add Apple\ folders/Misc\ Apple\ \]\[\ III\ cards\ 1980s/Apple\ Cork\ Single\ Stepper/
$ git status
$ git push --verbose
$ git add Apple\ folders/Misc\ Apple\ \]\[\ III\ cards\ 1980s/Apple\ II\ Interface\ card/
$ git status
$ git push --verbose
$ git add Apple\ folders/Misc\ Apple\ \]\[\ III\ cards\ 1980s/Apple\ III\ Profile\ Card/
$ git status
$ git push --verbose
$ git add Apple\ folders/Misc\ Apple\ \]\[\ III\ cards\ 1980s/Disk\ Controller/
$ git status
$ git push --verbose
$ git add Apple\ folders/Misc\ Apple\ \]\[\ III\ cards\ 1980s/IIc\ PSU/
$ git status
$ git push --verbose
$ git add Apple\ folders/Misc\ Apple\ \]\[\ III\ cards\ 1980s/IO\ Controller/
$ git status
$ git push --verbose
$ git add Apple\ folders/Misc\ Apple\ \]\[\ III\ cards\ 1980s/Misc\ Cards/
$ git status
$ git push --verbose
$ git add Apple\ folders/Misc\ Apple\ \]\[\ III\ cards\ 1980s/Printer\ card\ pSilenttype/
$ git status
$ git push --verbose
$ git add Apple\ folders/Misc\ Apple\ \]\[\ III\ cards\ 1980s/prototype\ card/
$ git status
$ git push --verbose
$ git add Apple\ folders/Misc\ Apple\ \]\[\ III\ cards\ 1980s/RF\ modulator/
$ git status
$ git push --verbose
$ git add Apple\ folders/Misc\ Apple\ \]\[\ III\ cards\ 1980s/ROM\ Cards/
$ git status
$ git push --verbose
$ git add Apple\ folders/Misc\ Apple\ \]\[\ III\ cards\ 1980s/Serial\ Interface\ Card/
$ git status
$ git push --verbose
$ git add Apple\ folders/Misc\ Apple\ \]\[\ III\ cards\ 1980s/Speech\ Recognition\ Card/
$ git commit
$ git status

Notes:

  • Lots of backspace escaping because of pesky spaces in the folder and filenames
  • Each git status was to check if no .zip files were included that contained duplicate files.
  • The $ find . -iname thumbs.db -delete deleted the pesky Thumbs.db files that Windows versions before Windows Vista generated locally and were in the pCloud download.
  • This is indeed a lot of effort to work around the server side HTTP 502 resultcode, but it allows a client-side fix that pushes the commit sizes under 25 mebibyte and works fine on GitLab.

Links

GitLab pages

GitLab pages has changed since I wrote Setting up a GitLab project so it is served over https as a gitlab.io and a custom subdomain after creating [Wayback/Archive] wiert.gitlab.io/wiert to which wiert.gitlab.io is an alias.

Back then, the page immediately became publicly visible, the configuration file [Wayback/Archive] .gitlab-ci.yml · master · Jeroen Wiert Pluimers / wiert · GitLab was static, it defaulted to alpine:latest and is available in a path under gitlab.io.

Now the configuration file is parameterised, and I opted to

  1. Change the new default busybox back to alpine:latest because BusyBox lacks a lot of tooling and has compatibility issues compared to Linux tooling; and I hope Alpine Linux is better at this; I think it uses [Wayback/Archive] Image Layer Details – alpine:latest)

After deployment, I found out the page was in a random gitlab.io subdomain instead of a path. That probably makes using specific HTTPS certificates easier, but also harder to remember the URL. So I changed that back and added : script parameters in the before_script and script blocks so I know which places I can change:

[Wayback/Archive] Initial .gitlab-ci.yml with : commented “before_script” and “script” to… (62d52829) · Commits · wiert / public / web / sites / gitlab.io / Apple-Cork-Cupertino-Arhive-folders · GitLab changed

from:

# This file is a template, and might need editing before it works on your project.
# Full project: https://gitlab.com/pages/plain-html

image: busybox

pages:
  stage: deploy
  script:
    - echo "The site will be deployed to $CI_PAGES_URL"
  artifacts:
    paths:
      - public
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH

to:

# The Docker image that will be used to build your app
image: alpine:latest
create-pages:
  pages:
    # The folder that contains the files to be exposed at the Page URL
    publish: public
  rules:
    # This ensures that only pushes to the default branch will trigger
    # a pages deploy
    - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
  # Functions that should be executed before the build script is run
  before_script:
    - ":"
  script:
    - ":"
GitLab Pages links:
  • [Wayback/Archive] gitlab pages make public at DuckDuckGo
  • [Wayback/Archive] GitLab Pages public folder | GitLab Docs

    The “History” bit by default is invisible but explains part of the .gitlab-ci.yml changes.

  • [Wayback/Archive] GitLab Pages settings | GitLab Docs

    Customize the default folder
    • Introduced in GitLab 16.1 with a Pages flag named FF_CONFIGURABLE_ROOT_DIR. Disabled by default.
    • Enabled on GitLab.com in GitLab 16.1.
    • Enabled on GitLab Self-Managed in GitLab 16.2.
    • Changed to allow variables when passed to publish property in GitLab 17.9.
    • Moved the publish property under the pages keyword in GitLab 17.9.
    • Appended the pages.publish path automatically to artifacts:paths in GitLab 17.10.

    By default, Pages looks for a folder named public in your build files to publish it.

    To change that folder name to any other value, add a pages.publish property to your deploy-pages job configuration in .gitlab-ci.yml.

    The following example publishes a folder named dist instead:

    create-pages:
      script:
        - npm run build
      pages:  # specifies that this is a Pages job
        publish: dist

  • [Wayback/Archive] Project and group visibility | GitLab Docs has this new bit:
    Change the visibility of individual features in a project

    You can change the visibility of individual features in a project.

    Prerequisites:

    • You must have at least the Maintainer role for the project.
    1. On the top bar, select Search or go to and find your project.
    2. Select Settings > General.
    3. Expand Visibility, project features, permissions.
    4. To enable or disable a feature, turn on or turn off the feature toggle.
    5. Select Save changes.

    This opted me for to change the “Project visibility” value to “Public”

To get a better grasp of the why and how of the Plain Html template changes:

.gitlab-ci.yml links

Bash tips: removing Thumbs.db regardless of casing; generating html index pages for media

The first turned out to be simple:

Maybe the second is easier than I thought:

vscode tips: Showing spaces and tabs; embedding text with a tag

I always forget how to do the first; the key thing is that the aggregate of tabs and spaces is whitespace:

The second – wrapping text in a tag – has become easier and is now built-in as Emmet apparently got integrated a long time ago:

More links on the HTTP 502 curl 22 error

On the http.postBuffer setting

This basically never solves a real problem, but just in creases resource consumption

  • [Wayback/Archive] Git – gitfaq Documentation
    What does http.postBuffer really do?
    This option changes the size of the buffer that Git uses when pushing data to a remote over HTTP or HTTPS. If the data is larger than this size, libcurl, which handles the HTTP support for Git, will use chunked transfer encoding since it isn’t known ahead of time what the size of the pushed data will be.

    Leaving this value at the default size is fine unless you know that either the remote server or a proxy in the middle doesn’t support HTTP/1.1 (which introduced the chunked transfer encoding) or is known to be broken with chunked data. This is often (erroneously) suggested as a solution for generic push problems, but since almost every server and proxy supports at least HTTP/1.1, raising this value usually doesn’t solve most push problems. A server or proxy that didn’t correctly support HTTP/1.1 and chunked transfer encoding wouldn’t be that useful on the Internet today, since it would break lots of traffic.

    Note that increasing this value will increase the memory used on every relevant push that Git does over HTTP or HTTPS, since the entire buffer is allocated regardless of whether or not it is all used. Thus, it’s best to leave it at the default unless you are sure you need a different value.

  • [Wayback/Archive] Git – git-config Documentation

    http.postBuffer
    Maximum size in bytes of the buffer used by smart HTTP transports when POSTing data to the remote system. For requests larger than this buffer size, HTTP/1.1 and Transfer-Encoding: chunked is used to avoid creating a massive pack file locally. Default is 1 MiB, which is sufficient for most requests.

    Note that raising this limit is only effective for disabling chunked transfer encoding and therefore should be used only where the remote server or a proxy only supports HTTP/1.0 or is noncompliant with the HTTP standard. Raising this is not, in general, an effective solution for most push problems, but can increase memory consumption significantly since the entire buffer is allocated even for small pushes.

  • [Wayback/Archive] Git – git-config Documentation (for the version 2.15.4 version I was using at that time)

    http.postBuffer
    Maximum size in bytes of the buffer used by smart HTTP transports when POSTing data to the remote system. For requests larger than this buffer size, HTTP/1.1 and Transfer-Encoding: chunked is used to avoid creating a massive pack file locally. Default is 1 MiB, which is sufficient for most requests.

  • [Wayback/Archive] git error: RPC failed; HTTP 502 curl 22 The requested URL returned error: 502 Proxy Error – Stack Overflow was very similar to my problem and suggested both the http.postBuffer setting and sending updates in chunks (thanks [Wayback/Archive] Homer, [Wayback/Archive] TheSprinter and [Wayback/Archive] Rahimuddin):

    Q

    When I want to push/pull/clone (HTTPS), I get the following error:

    fatal: The remote end hung up unexpectedly error: RPC failed; HTTP 502 curl 22 The requested URL returned error: 502 Proxy Error

    A

    This kind of error happens mostly because of two reasons:

    1. pushing binary files/JAR files to the repository
    2. if the file(s) size is big.

    Solution:

    1. Use administrator credentials for pushing a code change
    2. execute the command git config --local http.postBuffer 157286400 before pushing.

    A

    Updating http.postBuffer didn’t work for me. In my case, I had 17 files to push. So I have pushed 17 files in chunks. Like 4-5 files together. It did solve my issue.

  • [Wayback/Archive] The remote end hung up unexpectedly while git cloning – Stack Overflow (despite being about clone instead of push) links to and quotes a good explanation on the underlying issues that http.postBuffer does not solve (thanks [Wayback/Archive] Joe and [Wayback/Archive] VonC):

    A

    With Git 2.25.1 (Feb. 2020), you know more about this http.postBuffer “solution”.

    See commit 7a2dc95commit 1b13e90 (22 Jan 2020) by brian m. carlson (bk2204).
    (Merged by Junio C Hamano — gitster — in commit 53a8329, 30 Jan 2020)
    (Git Mailing list discussion)

    docs: mention when increasing http.postBuffer is valuable

    Signed-off-by: brian m. carlson

    Users in a wide variety of situations find themselves with HTTP push problems.

    Oftentimes these issues are due to antivirus software, filtering proxies, or other man-in-the-middle situations; other times, they are due to simple unreliability of the network.

    However, a common solution to HTTP push problems found online is to increase http.postBuffer.

    This works for none of the aforementioned situations and is only useful in a small, highly restricted number of cases: essentially, when the connection does not properly support HTTP/1.1.

    Document when raising this value is appropriate and what it actually does, and discourage people from using it as a general solution for push problems, since it is not effective there.

    A VPN by itself does not automagically make GitHub “HTTP/1.0-only”, but many VPN setups do route your traffic through corporate proxies / SSL inspection gateways / filtering middleboxes. Those intermediaries are exactly the kind of thing that can be non-compliant with HTTP/1.1, especially with Transfer-Encoding: chunked.

    Still, increasing http.postBuffer can still help:

    • http.postBuffer only affects smart HTTP POST requests (something I mentioned since 2010/2013), and specifically whether Git/libcurl can use chunked transfer encoding or must send a normal request with a fixed Content-Length.
    • If your VPN/proxy breaks or rejects chunked encoding, the connection can get dropped and you will see errors like “remote end hung up“.
    • Raising http.postBuffer may avoid chunking (by keeping the request under the buffer threshold), which can make the operation succeed through that broken middlebox.

    However:

    1. That only applies to HTTP(S) remotes: If you are cloning over SSH (git@github.com:org/repo.git or ssh://...), http.postBuffer is irrelevant; any “it worked after setting it” was coincidence (or you were not actually using SSH).
    2. If the failure happens mid-download (“Receiving objects ...“), http.postBuffer often is not the real fix, because it does not change the response path; you may simply have hit a “lucky” network window.

    If you want to confirm whether you are hitting the chunked/proxy edge case, enable verbose tracing (as mentioned before) and look for Transfer-Encoding: chunked in the request:

    # Linux/macOS
    export GIT_TRACE=1
    export GIT_CURL_VERBOSE=1
    
    # Windows (cmd)
    set GIT_TRACE=1
    set GIT_CURL_VERBOSE=1
    

    If you see chunked requests and the VPN/proxy drops them, http.postBuffer is a reasonable workaround. Otherwise, prefer fixing the actual network/proxy issue (or bypass it by switching networks / using SSH / disabling the problematic proxy layer).

Queries

--jeroen


¹ Original console output before changing settings

git push

$ git push
Enumerating objects: 429, done.
Counting objects: 100% (429/429), done.
Delta compression using up to 8 threads
Compressing objects: 100% (428/428), done.
Writing objects: 100% (428/428), 681.08 MiB | 2.93 MiB/s, done.
Total 428 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
error: RPC failed; HTTP 502 curl 22 The requested URL returned error: 502
send-pack: unexpected disconnect while reading sideband packet
fatal: the remote end hung up unexpectedly
Everything up-to-date

git push --verbose

$ git push --verbose
Pushing to https://gitlab.com/wier1/public/web/sites/gitlab.io/apple-cork-cupertino-arhive-folders.git
Enumerating objects: 429, done.
Counting objects: 100% (429/429), done.
Delta compression using up to 8 threads
Compressing objects: 100% (428/428), done.
POST git-receive-pack (chunked)
Writing objects: 100% (428/428), 681.08 MiB | 2.94 MiB/s, done.
Total 428 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
error: RPC failed; HTTP 502 curl 22 The requested URL returned error: 502
send-pack: unexpected disconnect while reading sideband packet
fatal: the remote end hung up unexpectedly
Everything up-to-date

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.