error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)
I tried 'push' while writing 'git'. However, the following message does not solve the problem.
You can force git using http version 1.1
git config --global http.version HTTP/1.1
git config http.postBuffer 524288000 can not fix this issue. But @AbhishekSharma's question is good, why should we downgrade the HTTP version.--global flag, unless you always work with the same central server. If you work with multiple servers (e.g. GitHub, BitBucket, GitLab, etc.), then you may want to set this config in a repo-by-repo basis.You might be pushing data larger than the postBuffer size.
You can try increasing post buffer size using
git config --global http.postBuffer 157286400
For reference: https://confluence.atlassian.com/bitbucketserverkb/git-push-fails-fatal-the-remote-end-hung-up-unexpectedly-779171796.html
Simple and safe solution :
git config http.version HTTP/1.1
git push
git config --unset http.version
(resets to default after pushing)
git config http.version HTTP/1.1 for that repository? That way you don't need to set it back to HTTP/2 afterwards. Since that change will only apply to the current git repository.HTTP/2 is a default, not a set configuration name. This is the case when git config --global http.version returns nothing. In that case, the commands should be git config --global http.version HTTP/1.1; git push; git config --global --unset http.version A bash script that does the right thing in either case is left as an exercise for the reader!XCode 11.4.1
Increasing the git buffer size worked for me
git config --global http.postBuffer 524288000
--global tag makes it so that all git repositories you have will have a postBuffer of that amount. Omitting global means only that git repo will have a postBuffer of 524288000I encountered this error when pushing using an ADSL Broadband Wi-Fi network with low signal strength, low stability, and low speed.
Then, I was able to push it very successfully when I pushed using a Fibre Broadband Wi-Fi network with greater signal strength, greater stability, and higher speed.
Error:
Push failed Enumerating objects: 44, done. Delta compression using up to 12 threads RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: CANCEL (err 8) the remote end hung up unexpectedly Total 30 (delta 18), reused 0 (delta 0) the remote hung up unexpectedly
It's was not working for me. But worked after downgrading version of HTTP from 2 to 1.1:
$ git config --global http.version HTTP/1.1
After this change, pushing was successful and I have changed HTTP version to 2 again:
$ git config --global http.version HTTP/2
you can use this if you have problems with your internet connection :
git config --global http.postBuffer 524288000 # Set buffer size to 500 MB
git config --global http.lowSpeedLimit 0 # Disable low speed limit
git config --global http.lowSpeedTime 999999 # Set low speed time limit to a large value
In my case I had to reset the origin to ssh instead of http/https:
git remote set-url origin [email protected]
To check your origins you can use:
git remote -v
In most cases, increasing the buffer size will work.
git config http.postBuffer 524288000
It worked for me.
Use of
git config --global http.version HTTP/1.1
should be kept as a last option.
Using a gitbash terminal on a windows machine (if this info helps you in any way).
I think, It's happening because I am on a slow internet connection and I have to clone a decently huge git repository. The most common issue is that the connection closes and the whole clone is cancelled.
Cloning into 'large-repository'...
remote: Counting objects: 20248, done.
remote: Compressing objects: 100% (10204/10204), done.
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
After a lot of trial and errors and a lot of “remote end hung up unexpectedly” I have a way that works for me. The idea is to do a shallow clone first and then update the repository with its history.
$ git clone http://github.com/large-repository --depth 1
$ cd large-repository
$ git fetch --unshallow
In most cases git config http.postBuffer 524288000 should work.
In my case, I was pushing a large number of changes (I changed a lot of packages thus there were many lines updated) in my yarn.lock/package-lock.json file. Since it is usually not required, removing it made the error go away. So you can try this too if you are working with Javascript
If none of this helps, maybe you could try using ssh to connect to your git repository. That helped me.
If you are using Bitbucket you can add your ssh key to the repository settings and that way you will gain ssh access. On Github I think you should have ssh access by default. Try connecting to the repository using ssh instead of https, you can do that by changing the remote url for your git.
I received similar error while cloning one of the big project from gitlab environment. Happens due to unstable internet. Here is what the error I got
...
...
error: RPC failed; curl 92 HTTP/2 stream 7 was not closed cleanly before end of the underlying stream
error: 7739 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
fatal: error EOF
fatal: fetch-pack: invalid index-pack output
Here is the solution that worked for me.
$ git clone http://github.com/big-repo.git --depth 1
$ cd big-repo
$ git fetch --unshallow
It sounds like either the remote server you're using or some middlebox (e.g., a proxy) is not speaking the HTTP/2 protocol correctly. You can either fix that by asking the owner of that remote server or middlebox to fix their server, or you can force the use of HTTP/1.1.
If you want to force the use of HTTP/1.1, you can set the http.version configuration option to HTTP/1.1. That can also be set on a per-URL basis as described in the http.<url>.* section in the git-config manual page.
One of the most popular answers is:
git config --global http.postBuffer 157286400
Don't do this blindly as 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(from the git documentation).
Check if you've files with size >100 MB first. If yes, then there is a better-suited solution for your problem.
Solution: Git-LFS as it is intended for versioning large files.
Git Large File Storage (LFS) replaces large files such as audio samples, videos, datasets, and graphics with text pointers inside Git, while storing the file contents on a remote server like GitHub.com or GitHub Enterprise.
You can look at this good tutorial on git-lfs which will answer most of your follow-up questions.
For my case with the bitbucket behind nginx, disabling proxy request buffering was the answer:
server {
listen 443 ssl http2 default_server;
...
proxy_request_buffering off;
# These are also relevant:
proxy_read_timeout 600;
client_max_body_size 0;
Using different internet access solved the problem for me, I switched from my main wifi and connect to my phone and it worked.
My issue was slightly different, with a "packages already packed" info with the RPC::HTTP/2 stream not closed cleanly message.
For me this worked:
git checkout --orphan newBranch
git add -A # Add all files and commit them
git commit -am "Clean Repo"
git branch -D master # Deletes the master branch
git branch -m master # Rename the current branch to master
git push -f origin master # Force push master branch to github
Ironically, for me it turned out to be bad internet connection - I tried everything above, nothing worked, then I did a speed test and found I had 100+Mb download but only 0.x Mb upload at the time, due to some wifi issues. After I fixed it the problem disappeared.
Anyone looking for an elegant solution, which worked for me is to use SSH way of the repository. This problem only occurs when we use HTTPS repo path.
So I changed my path to below, and that resolved the problem.
git remote set-url origin [email protected]:mrimran/PyTorchUltimateMaterial.git
I faced an issue while integrating Stripe in iOS using CocoaPods. After trying various solutions, the only thing that worked for me was switching to different networks.
However, before that, I also tried this command, which might help others:
git config http.postBuffer 1024M
Make sure not to use the --global flag with this command.
I went through a similar situation. I tried;
git config --global http.version HTTP/1.1
git config --global http.postBuffer 157286400
git config --global http.postBuffer 524288000
even,
git config --global core.compression 0
but, nothing changed. I had two folders with this error. one with 10MB size and one with 65MB.
finally. I tried with a Fibre connection.
So yeah. try with a different, higher speed connection. probably it will work.
Good Luck!
I live rurally and have mobile broadband, that is based on a very low 4g signal, I get two bars of signal on a good day. I was pushing several files amounting to only 39mb, which is well below github's max file size, I have also pushed much bigger commits on the same repo from this location, so it did not make sense that the file size caused the problems for me. I tried everything mentioned here, changing to HTTP1, and changing postbuffer did not help.
After several hours of head scratching, I restarted my router and was able to push the commit to github.
Hopefully this can help someone out there that also has terrible a internet connection.
It could be due to low signal strength. I have pushed heavy files in the open source repositories too and haven't encountered this error. More than the buffer size, it depends largely on the signal strength. You could try pushing it 2 or 3 times more or restart your router, and if it still doesn't work, try the following command:
git config http.postBuffer 524288000
git push
You really might be pushing data having large size. I was having the same error then I preferred using git LFS and it worked.
Just untrack that specific file (file with huge size) before commit. Use following command.
git rm --cached "<file_name>
Then push remaining files and then use git LFS to upload the file with large size. To know how to upload using git LFS refer this.
git push origin branch_nameand there was no remote branch corresponding to the local branch I'm trying to push.