git push ファイルサイズ容量超えた

gitでoriginにpushするとファイルサイズの容量がgithubのリミット(100MB)超えてたらしくerror.

と簡単に言われてもそのファイルは結構前のコミットからある..もちろんそのファイルを今消してcommitしたところで履歴にあるのでerrorの解決とはならず.

remote: Resolving deltas: 100% (29/29), completed with 2 local objects.
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: 4dc76f7fa5419f828cf0c8161ccac5ec
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File det-paper/figures/bar_graph/barh_multi_spectrum.eps is 139.10 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File det-paper/figures/bar_graph/barh_each_spectrum.eps is 139.10 MB; this exceeds GitHub's file size limit of 100.00 MB
To https://github.com/mil-tokyo/inf-iros2017.git
 ! [remote rejected] master -> master (pre-receive hook declined)

エラーに苦しんだ.

いろいろ調べたところ全てのコミットからそのファイルの存在消せるらしく

git filter-branch --tree-filter 'rm -f ファイル名' HEAD

解決.(問題のファイルが2つあり,2回目はこのコマンドを-f でやらなきゃだった.)

参考

git pushで100MBを超えてエラーが出たときの対処法 - プログラミングの詰まりどころを、懇切丁寧に