1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【GitHub】error: RPC failed; HTTP 400 curl 22 The requested URL returned error: 400の解決方法

Posted at

問題

複数回(10回分程度)のコミットをまとめて git push したところ、以下のエラーが発生しました。

# エラー抜粋
error: RPC failed; HTTP 400 curl 22 The requested URL returned error: 400
% git push origin main
Enumerating objects: 119, done.
Counting objects: 100% (119/119), done.
Delta compression using up to 8 threads
Compressing objects: 100% (76/76), done.
error: RPC failed; HTTP 400 curl 22 The requested URL returned error: 400
send-pack: unexpected disconnect while reading sideband packet
Writing objects: 100% (100/100), 1.13 MiB | 2.43 MiB/s, done.
Total 100 (delta 28), reused 0 (delta 0), pack-reused 0
fatal: the remote end hung up unexpectedly
Everything up-to-date

画像もコミットに含めていましたが、各ファイルのサイズはそれほど大きくありません。

% git ls-files -s | grep '.png' | awk '{print $4}' | xargs -I{} du -h {}
220K    mdn/docs/Learn_web_development/Howto/Tools_and_setup/image.png
540K    pm2/docs/usage/image-1.png
336K    pm2/docs/usage/image-2.png
260K    pm2/docs/usage/image.png
 96K    pm2/image.png
 56K    prisma/docs/orm/overview/image-1.png
 44K    prisma/docs/orm/overview/image.png
 64K    prisma/docs/orm/prisma-schema/data-model/image.png

解決方法

単純ですが効果的な方法は、コミットを小分けにして順番にpushすることです。

# 小分けにpushする
git push origin main

一度にまとめてpushすると、RPC エラーや接続切断が発生することがあります。
1~2個ずつコミットを小分けにしてpushすると、問題なく反映されました。

終わりに

  • GitHub にまとめて大きな push をすると RPC failed; HTTP 400 が出る場合がある
  • 原因は大容量のファイルや多数のオブジェクトの圧縮による通信の失敗
  • 小さく分けて push するのが簡単で確実な対処法
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?