LoginSignup
3
2

More than 5 years have passed since last update.

100MB超のファイルを間違えてコミットするとGitHubから拒否される件

Posted at

現象

リモートブランチにプッシュできない
特定のファイルが100MBを超えているから拒否されました!

ローカルの環境だと思って油断していたのが敗因。

対応

git rm hoge.log
だけでもダメ。履歴にそのファイルが残っているので、そもそもプッシュできない。

そこで、「100MBを超えたファイルをコミットした」履歴をまるごと削除する。

git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch [ファイル名]" --prune-empty -- --all
rm -rf .git/refs/original/
git reflog expire --expire=now --all
git gc --aggressive --prune=now

http://sd7lab.jp/github-push-100mb-limit/
https://www.walbrix.com/jp/blog/2013-10-github-large-files.html

結論

自分専用ブランチでもハマるときはハマる
プルリクを送るときは履歴までクリーンな状態で(理想)

3
2
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
3
2