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¹:
git pushgit 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
- break up the commit into smaller portions (this will re-break when combining commits)
- 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 statuswas to check if no .zip files were included that contained duplicate files. - The
$ find . -iname thumbs.db -deletedeleted 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
- Change the new default
busyboxback toalpine:latestbecause 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
…
- GitLab 16.1 introduced support for configuring the published folder in
.gitlab-ci.yml. You no longer need to change your framework configuration. For more information, see set a custom folder to be deployed with Pages.
The “History” bit by default is invisible but explains part of the
.gitlab-ci.ymlchanges. - GitLab 16.1 introduced support for configuring the published folder in
- [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
publishproperty in GitLab 17.9. - Moved the
publishproperty under thepageskeyword in GitLab 17.9. - Appended the
pages.publishpath automatically toartifacts:pathsin GitLab 17.10.
By default, Pages looks for a folder named
publicin your build files to publish it.To change that folder name to any other value, add a
pages.publishproperty to yourdeploy-pagesjob configuration in.gitlab-ci.yml.The following example publishes a folder named
distinstead:create-pages: script: - npm run build pages: # specifies that this is a Pages job publish: dist…
- Introduced in GitLab 16.1 with a Pages flag named
- [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.
- On the top bar, select Search or go to and find your project.
- Select Settings > General.
- Expand Visibility, project features, permissions.
- To enable or disable a feature, turn on or turn off the feature toggle.
- 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:
- [Wayback/Archive] GitLab Pages examples / plain-html · GitLab
- [Wayback/Archive] Commits · main · GitLab Pages examples / plain-html · GitLab
- [Wayback/Archive] Update README.md to main branch rather than master (25221ee9) · Commits · GitLab Pages examples / plain-html · GitLab
- [Wayback/Archive] Use busybox instead of Alpine (f8ee116a) · Commits · GitLab Pages examples / plain-html · GitLab
.gitlab-ci.yml links
- [Wayback/Archive] CI/CD YAML syntax reference | GitLab Docs
- Global keywords used: none
- Job keywords used:
- CI/CD YAML syntax reference | GitLab Docs:
image - CI/CD YAML syntax reference | GitLab Docs:
pages - CI/CD YAML syntax reference | GitLab Docs:
stage - CI/CD YAML syntax reference | GitLab Docs:
script - CI/CD YAML syntax reference | GitLab Docs:
artifacts - CI/CD YAML syntax reference | GitLab Docs:
rules - CI/CD YAML syntax reference | GitLab Docs:
script - CI/CD YAML syntax reference | GitLab Docs:
before_script - CI/CD YAML syntax reference | GitLab Docs:
default
- CI/CD YAML syntax reference | GitLab Docs:
- [Wayback/Archive] Deprecated keywords | GitLab Docs at first confusing to be, until I bolded the globally and further bit:
Defining
image,services,cache,before_script, andafter_scriptglobally is deprecated. Usedefaultinstead. - To make the YAML syntax of .yml harder, it does not distinguish keys to be between keywords and names
create-pages:is a job name, not a keyword
- Examples:
- [Wayback/Archive] Tutorial: Create and run your first GitLab CI/CD pipeline | GitLab Docs
- [Wayback/Archive] Tutorial: Create a complex pipeline | GitLab Docs
- [Wayback/Archive] .gitlab-ci.yml · master · GitLab.org / GitLab · GitLab referencing a 5 year old bug:
- [Wayback/Archive] GitLab Pages examples · GitLab (showing that
create-pages:is a job name) - [Wayback/Archive] Tutorial: Create a GitLab Pages website from scratch | GitLab Docs
- [Wayback/Archive] GitLab Pages examples / plain-html · GitLab
Bash tips: removing Thumbs.db regardless of casing; generating html index pages for media
The first turned out to be simple:
- [Wayback/Archive] bash recursively remove thumbs.db at DuckDuckGo
- [Wayback/Archive] Using pipes to delete all occurences of Thumbs.db file from Ubuntu Laptop – Stack Overflow (thanks [Wayback/Archive] w2lame and [Wayback/Archive] blee):
A
findalready has a delete function, so no pipes are necessary:find . -iname thumbs.db -deleteThis says delete all files matchingthumbs.dbregardless of capitalization, recursively from my current working directory.
Maybe the second is easier than I thought:
- [Wayback/Archive] bash generate html indexed pages of folder hierarchy at DuckDuckGo
- [Wayback/Archive] GitHub – IORoot/htmltree: Generate HTML index.html files in a linux file structure. is – despite the .sh extension suggesting Bourne Shell – a bash script supporting templates for header, footer, file item and directory item.
The script does only one folder level at a time, to it needs some recusion
- [Wayback/Archive] bash – shell script to create a static HTML directory listing – Stack Overflow (thanks [Wayback/Archive] Joel Glovier, and [Wayback/Archive] Nicolai Weitkemper)
Q
So what I’d like to do is run a script on the command line and have it browse the root for directories, list all the files inside (which only go one level deep), and output that to an html
ul > li > astructureA
tree -H . -o _includes/site-index.htmlshould do everything you asked for.There are some more options you might consider, like
-T title. Refer to the XML/JSON/HTML OPTIONS section in the man page.The man page link is broken, but luckily there is mankier: [Wayback/Archive] tree: list contents of directories in a tree-like format. | Man Page | Commands | tree | ManKierThere are various [Wayback/Archive] tree: list contents of directories in a tree-like format. | Man Page | Commands | tree | ManKier: /JSON/HTML/Hyperlinks Options but they provide less templating than the non-recursive htmltree script above.
- ____________________________________________
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:
- [Wayback/Archive] vscode show spaces and tabs at DuckDuckGo
- [Wayback/Archive] Show whitespace characters in Visual Studio Code – Stack Overflow (thanks [Wayback/Archive] Etienne van Delden De la Haije, [Wayback/Archive] revo and [Wayback/Archive] aloisdg)
A
VS Code 1.6.0 and Greater
As mentioned by aloisdg below,
editor.renderWhitespaceis now an enum taking eithernone,boundaryorall. To view all whitespaces:"editor.renderWhitespace": "all",Before VS Code 1.6.0
Before 1.6.0, you had to set
editor.renderWhitespacetotrue:"editor.renderWhitespace": trueIn the GUI, it’s this setting:

In settings, search for “whitespace”, then set the “Editor: Render Whitespace” to “all”
[Wayback/Archive] 537115007-87513a79-b573-4fd9-a3e5-e84fa57e8f05.png (1738×810)
- [Wayback/Archive] gitlab pages “tree” “bash” at DuckDuckGo did not return useful pages for me.
The second – wrapping text in a tag – has become easier and is now built-in as Emmet apparently got integrated a long time ago:
- [Wayback/Archive] vscode wrap with html anchor at DuckDuckGo
- [Wayback/Archive] html – How can I do tag wrapping in Visual Studio Code? – Stack Overflow (thanks [Wayback/Archive] hannes neukermans and [Wayback/Archive] Alex)
A
Embedded Emmet could do the trick:
- Select text (optional)
- Open command palette (usually Ctrl+Shift+P)
- Execute
Emmet: Wrap with Abbreviation - Enter a tag
div(or an abbreviation.wrapper>p) - Hit Enter
Command can be assigned to a keybinding.
I seemed to have missed this: [Wayback/Archive] Emmet in Visual Studio Code
Support for Emmet snippets and expansion is built right into Visual Studio Code, no extension required. Emmet 2.0 has support for the majority of the Emmet Actions including expanding Emmet abbreviations and snippets.
…
Emmet abbreviation and snippet expansions are enabled by default in
html,haml,pug,slim,jsx,xml,xsl,css,scss,sass,lessandstylusfiles, as well as any language that inherits from any of the above likehandlebarsandphp.Time to learn [Wayback/Archive] Emmet — the essential toolkit for web-developers especially with this answer:
- [Wayback/Archive] Visual Studio Code shortcut to wrap HTML element into container tag – Super User (thanks [Wayback/Archive] Simon Ferndriger and [Wayback/Archive] Destroy666)
A
I don’t know if there’s an extension that does your exact 2 steps, but here’s a very way to do it in 3:- Select a HTML tag, collapsed or not – doesn’t matter.
- Press hotkey for
editor.emmet.action.wrapWithAbbreviationcommand. By default it’s unset, so you need to configure it. - Enter the tag that will wrap what you selected.
A way to do it in 2 steps could be with help of snippets, perhaps. You could create a bunch of snippets for different tags, like:"Wrap with div": { "scope": "html", "prefix": "wrap", "body": "<div>$TM_SELECTED_TEXT</div>" }And then create a bunch of hotkey macros for first selecting the whole tag (e.g.editor.emmet.action.balanceOut) and then calling each of your snippet called witheditor.action.insertSnippetand theseargs:{ "name": "Wrap with div" }. See e.g. this answer for examples of defining macros. - ____________________________________________
More links on the HTTP 502 curl 22 error
- [Wayback/Archive] I got a 502 on a push into gitlab this morning : gitlab was about
! [remote rejected] main -> main (pre-receive hook declined), which was not the case for me. - [Wayback/Archive] gitlab – GIT push, HTTP code = 502 error – Stack Overflow
- [Wayback/Archive] error: RPC failed result=22 – Push to Stash fails | Atlassian Support | Atlassian Documentation
- [Wayback/Archive] Pushing merge to master fails (Failed to authorize + 502 error in web interface) – How to Use GitLab – GitLab Forum
- [Wayback/Archive] 502 Whoops, GitLab is taking too much time to respond. (#7354) · Issue · gitlab-org/omnibus-gitlab
- [Wayback/Archive] Reinstalled Gitlab, getting Error 502 when pushing/pulling (#2851) · Issue · gitlab-org/omnibus-gitlab
- [Wayback/Archive] Gitlab 502 Error | Synology Community
- [Wayback/Archive] Git error: RPC failed; HTTP 502 curl 22 The requested URL returned error: 502 Proxy Error – Stack Overflow
- [Wayback/Archive] error: RPC failed; HTTP 502 curl 22 The requested URL returned error: 502 Bad Gateway · Issue #4305 · gogs/gogs
- [Wayback/Archive] error: RPC failed; HTTP 502 curl 22 The requested URL returned error: 502 Bad Gateway fatal: The remote end hung up unexpectedly (#27561) · Issue · gitlab-org/gitlab-foss
- [Wayback/Archive] RPC failed; HTTP 502 curl 22 The requested URL returned error: 502 · Issue #1222 · pre-commit/pre-commit
- [Wayback/Archive] error: RPC failed result=22 – Push to Bitbucket Server fails | Bitbucket Data Center | Atlassian Support
- [Wayback/Archive] error: RPC failed; HTTP 502 curl 22 The requested URL returned error: 502 Bad Gateway fatal: The remote end hung up unexpectedly (#27561) · Issue · gitlab-org/gitlab-foss
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.postBufferreally 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.
- What does
- [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:
- pushing binary files/JAR files to the repository
- if the file(s) size is big.
Solution:
- Use administrator credentials for pushing a code change
- execute the command
git config --local http.postBuffer 157286400before 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
cloneinstead ofpush) 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 7a2dc95, commit 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 valuableSigned-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.postBuffercan still help:http.postBufferonly affects smart HTTP POST requests (something I mentioned since 2010/2013), and specifically whether Git/libcurlcan use chunked transfer encoding or must send a normal request with a fixedContent-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.postBuffermay avoid chunking (by keeping the request under the buffer threshold), which can make the operation succeed through that broken middlebox.
However:
- That only applies to HTTP(S) remotes: If you are cloning over SSH (
git@github.com:org/repo.gitorssh://...),http.postBufferis irrelevant; any “it worked after setting it” was coincidence (or you were not actually using SSH). - If the failure happens mid-download (“
Receiving objects ...“),http.postBufferoften 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: chunkedin the request:# Linux/macOS export GIT_TRACE=1 export GIT_CURL_VERBOSE=1 # Windows (cmd) set GIT_TRACE=1 set GIT_CURL_VERBOSE=1If you see chunked requests and the VPN/proxy drops them,
http.postBufferis 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
- [Wayback/Archive] gitlab 502 during push at DuckDuckGo
- [Wayback/Archive] error: RPC failed; HTTP 502 curl 22 The requested URL returned error: 502 at DuckDuckGo
- [Wayback/Archive] git push error: RPC failed; HTTP 502 curl 22 The requested URL returned error: 502 at DuckDuckGo
- [Wayback/Archive] git git http.postBuffer at DuckDuckGo (that was a typo, but the search results were OK)
- [Wayback/Archive] git http.postBuffer at DuckDuckGo
- [Wayback/Archive] git http.postBuffer site:git-scm.com at DuckDuckGo
--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