LoginSignup
6
5

More than 3 years have passed since last update.

gitのcloneで「the remote end hung up unexpectedly」になった時の対処法

Posted at
この記事はmacOS Mojave バージョン10.14.6
gitのバージョン2.21.0を前提に書いています。

gitのcloneをしようとしたところ以下のようなエラーとともに失敗してしまったので解決方をメモします。

fatal: the remote end hung up unexpectedly

とーーっても時間がかかった挙句失敗したので、
対象のリポジトリが大きかったのが原因かなと思ました。
最新の状態さえ取得できればよかった(過去の履歴は不要)だったので、まずは以下の方法を試しました。

最新のコミットのみを取得するが失敗

git clone --depth 1 ttps://your-repository

これで試してみると、さっきよりはるかに早く処理が終わりましたが、また失敗。

gitの設定変更でうまくいった

ググってみるとリポジトリが肥大化しhttp.postBufferの設定を超えてしまっているというような情報があったので、以下を試してみました。

git config –global http.postBuffer 2M

再びgit clone --depth 1で試したところ今度はちゃんとcloneできました!

参考にさせていただいた記事
https://qiita.com/usamik26/items/7bfa61b31344206077fb
https://dream-target.jp/2019/03/17/git_remote_end_hung_up/

6
5
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
6
5