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...」)
 
行1: 行1:
  
 +
==git lfsとは==
 +
大きいファイルをgitで管理する機能
 +
brew install git-lfs
 +
 +
==git lfsインストール==
 +
macの場合
 +
$ brew install git-lfs
 +
$ git lfs version
 +
> git-lfs/2.13.3 (GitHub; darwin amd64; go 1.16.5)
 +
 +
参考:https://qiita.com/ikmski/items/5cc8b8832336b8d85429
 
==100MB以上のファイルをpushしたときのエラー対応方法==
 
==100MB以上のファイルをpushしたときのエラー対応方法==
 
  remote: error: GH001: Large files detected. You may want to try Git Large File Storage
 
  remote: error: GH001: Large files detected. You may want to try Git Large File Storage

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

git lfsとは

大きいファイルをgitで管理する機能 brew install git-lfs

git lfsインストール

macの場合

$ brew install git-lfs
$ git lfs version
> git-lfs/2.13.3 (GitHub; darwin amd64; go 1.16.5)

参考:https://qiita.com/ikmski/items/5cc8b8832336b8d85429

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