facebook twitter hatena line email

「Git/github/大きなファイル」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(ページの作成:「 ==100MB以上のファイルをpushしたときのエラー対応方法== remote: error: GH001: Large files detected. You may want to try Git Large File Storage Git LF...」)
(相違点なし)

2021年8月16日 (月) 23:40時点における版

100MB以上のファイルをpushしたときのエラー対応方法

remote: error: GH001: Large files detected. You may want to try Git Large File Storage

Git LFS のインストール(macであれば)

brew install git-lfs

.gitattributesに100MB超えのファイルを追加(例:hogehoge/Libraries/libil2cpp.a)

$ git lfs track hogehoge/Libraries/libil2cpp.a
$ cat .gitattributes # 確認
hogehoge/Libraries/libil2cpp.a filter=lfs diff=lfs merge=lfs -text

ファイルをaddしpushする

git add .gitattributes
git push origin master

対象ファイルを `git log` してgitattributes登録前にファイルをcommitしている箇所があれば失敗するので、以下のようなロールバックですべて戻す必要がある

git reset --soft HEAD^

参考:https://qiita.com/kanaya/items/ad52f25da32cb5aa19e6