LoginSignup
20

More than 5 years have passed since last update.

gitでプッシュした時に「error: RPC failed; result=22, HTTP code = 411」と表示された時の対処

Posted at

事象

gitで画像ファイルをプッシュしようとした際に下記のエラーメッセージが表示され、実行に失敗する。

git.exe push --progress  "origin" master:master

Counting objects: 78, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (67/67), done.
Writing objects: 100% (71/71), 11.50 MiB | 3.43 MiB/s, done.
Total 71 (delta 8), reused 0 (delta 0)
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly
error: RPC failed; result=22, HTTP code = 411
Everything up-to-date


gitは正常に終了しませんでした (終了コード 1) (1841 ms @ 2015/02/16 15:49:55)

原因

「HTTP code = 411」はLength Required(コンテンツ長の指定が必要)という意味のエラーです。
Content-Lengthの指定がないのでサーバ側からアクセスが拒否されています。
gitではポストできるファイルサイズがデフォルトで1MBとなっています。
上記の事象の場合だと、11.5MBとなっているのでポストできるファイルサイズ上限1MBを超えてしまっている為にエラーが発生しています。

対策

ポストできるファイルサイズの上限値を変更する

上限を1MBから50MBに変更する場合
指定はバイトで行う必要があるので50MBの場合は 50 × 1024 × 1024 = 52428800となる

コマンドライン

git config http.postBuffer 52428800

TortoiseGit

  1. 右クリックして「TortoiseGit」-> 「Settings」を選択する。
  2. 左画面で「Git」を選択し、右画面の「Edit local .git/config」を選択する。
  3. 下記の内容を追記する。
config
[http]
  postBuffer = 52428800

これでプッシュができるようになっているはずです。

備考

ちなみに今回はすべて必要なファイルのプッシュだったので上限値を上げる対応してますが、プッシュしている対象は本当に必要なファイルかをまずはチェックしましょう。
(私の経験では、リポジトリ管理が不要なaiファイル、psdファイルもプッシュされていて上限値を超えているということがあったので)

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
20