なんとな~くしあわせ?の日記

「そしてそれゆえ、知識そのものが力である」 (Nam et ipsa scientia potestas est.) 〜 フランシス・ベーコン

git clone時にエラーとなる

git cloneに失敗する

wxWidgetsリポジトリをcloneしようとしたら以下の様なメッセージが表示されて失敗した。

$git clone <link>
Cloning into 'name_project'...
Password for '<link>':
remote: Counting objects: 100% (659/659), done.
error: RPC failed; result=18, HTTP code = 200B | 1 KiB/s
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: recursion detected in die handler

またStackOverflow様にお聞きした
clone - git bash: error: RPC failed; result = 18, HTP code = 200B | 1KiB/s - Stack Overflow

端末にはエラーコード18と書かれており、エラーコードを出しているのはgit内部のlibcurlであり、原因は予想したデータサイズと実際のデータサイズの不一致であるとわかる。参考:error: RPC failed; result=18, HTTP code = 0 - Bitbucket Knowledge Base - Atlassian Documentation

違うエラーコードの場合、「git RPC failed; result=hogehoge」でググるといろいろ出てくると思う。

対処

私の場合、リモートリポジトリをクローンするところでこのエラーが出てしまったため、「git config --global http.postBuffer ***」でhttp.postBufferの値を削っていくしかないようだ。gitで--global使うと、リポジトリごとの設定ではなくてgit全体の設定になってしまうのだが、とりあえず「git config --global http.postBuffer 24288000」と打ち込むことでgitのリポジトリクローンに成功した。