RPC failed; HTTP 400 curl 22 The requested URL returned error: 400 Bad Request
Asked Answered
M

9

22

I am trying to push my code from an old repository to a new repository as my old repository seems to be currupted somehow

getting following error:

Counting objects: 19815, done.
Compressing objects: 100% (5264/5264), done.
Writing objects: 100% (19815/19815), 44.91 MiB | 134.87 MiB/s, done.
Total 19815 (delta 14641), reused 19405 (delta 14283)
error: RPC failed; HTTP 400 curl 22 The requested URL returned error: 400 Bad Request
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly
Everything up-to-date

I tried git config http.postBuffer 524288000 but it did not help I even tried to do git push --force origin and git push --all but am receiving same error

Mukden answered 6/7, 2020 at 10:0 Comment(0)
N
1

I faced the same error. I had a task to move from one server to another (TFS to Azure), all the repositories, except one, were easily moved using THIS procedure. One repository, when trying to make a PUSH, threw out such an error. There are about 15 branches in this repository. I decided to transfer one branch at a time, using git push url://to/new/repository.git branch-to-move:new-branch-name. When I applied this option to the master branch, I got the same error. Then I transferred all other branches (there were no problems with them). After that, the master branch migrated without problems.

Nygaard answered 28/12, 2020 at 21:41 Comment(0)
T
62

I faced a similar issue on my Arch Linux machine. Apparently my issue was an HTTP buffer issue.

I got it to work by using

git config http.postBuffer 524288000

followed by

git pull && git push

This did the trick for me and I can push to my repositories. However I wonder if there is a better way of implementing this rather than running an extra command.

Tourane answered 2/4 at 8:53 Comment(1)
Solved it for me - this was due to pushing a few large imagesCladoceran
T
12

I faced a similar issue on my Arch Linux machine. Apparently my issue was an HTTP buffer issue.

Type this command:

git config http.postBuffer 524288000

Now you can see your problem got solved.

Thereabouts answered 4/4 at 4:28 Comment(2)
I also had this issue on ArchLinux, this worked for me.Occurrence
I faced this same error on my mac, but solved with this command. Thanks for the solution :)Gerik
B
2

You may try to use the upstream (tracking) reference in your git command, by adding the -u option.

git push -u origin master
Brynne answered 3/2, 2023 at 21:22 Comment(0)
R
2

It happened to me that it did not work for one internet connection (ZTE WLAN router). After switching to another one it worked. Specifying the user did not help in the first case. Unfortunately, I don't know how to debug the actual issue, but maybe this information helps someone else.

$ git push
Enumerating objects: 34, done.
Counting objects: 100% (34/34), done.
Delta compression using up to 16 threads
Compressing objects: 100% (21/21), done.
Writing objects: 100% (21/21), 3.11 KiB | 52.00 KiB/s, done.
Total 21 (delta 16), reused 0 (delta 0)
error: RPC failed; HTTP 400 curl 22 The requested URL returned error: 400
fatal: the remote end hung up unexpectedly
fatal: the remote end hung up unexpectedly
Everything up-to-date
Ruination answered 22/1 at 20:19 Comment(2)
Ha! Same here, I've switched from Huawei router to ZTE router and the problem started to appear.Evita
I've switched on my mobile internet connection and it worked. Had same problem previously with my old router.Strengthen
N
1

I faced the same error. I had a task to move from one server to another (TFS to Azure), all the repositories, except one, were easily moved using THIS procedure. One repository, when trying to make a PUSH, threw out such an error. There are about 15 branches in this repository. I decided to transfer one branch at a time, using git push url://to/new/repository.git branch-to-move:new-branch-name. When I applied this option to the master branch, I got the same error. Then I transferred all other branches (there were no problems with them). After that, the master branch migrated without problems.

Nygaard answered 28/12, 2020 at 21:41 Comment(0)
B
1

I was getting the same error even after updating the buffer size and HTTP version. This simple command worked for me

git push --all
Barvick answered 4/7 at 18:47 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Lowlife
A
0

I've faced same error this morning. Upgrading to newer version (2.29.2.windows.2) fixed the issue for me. Sorry, I didn't have time to take git trace or further investigate this issue. Thus just sharing my experience.

Asterism answered 28/11, 2020 at 2:50 Comment(2)
Thank you for sharing this. But please notice that it was better to write this as a comment instead of an answer according to the type of information you've provide.Hayleyhayloft
Thank you for your suggestion! This was my first time posting to SO, and I think I messed up... I will keep in mind to the deference b/w comments and solutions. Please let me know if it's better to delete this solution and write as comment instead.Asterism
C
0

I've encountered this issue when attempting to push a new branch to my repository. Failed with exactly this error. This is possibly a network issue caused by using an external VPN connection in my case. I managed to resolve it by lowering the MTU in my debian machine:

ip link set eth0 mtu 800
Chirm answered 16/6 at 21:26 Comment(0)
S
0

This was because I was pushing a lot of data to Github. Forgot to add node_modules in the .gitignore

Sucre answered 5/8 at 18:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.