Having accidentally put a pretty large file which was not excluded by .gitignore in my working directory i committed my changes, pushed up to github then did a git push heroku up to production.
when i saw it was trying to push 100s of MB of data up to heroku, i killed the process.
I have since done a
git rm filename.extension
followed by
git add ., a new commit and git push. But when i get to git push heroku it insists on continuing to push this impossibly large data file.
how can i check what the offending file is, and how can i make git/heroku forget it was ever there so git push heroku can start working again…?
Thanks!
If you did a
git rm large.file, the commit introducing thelarge.fileis still in the history of your repo.To make git forget about the commit, you’ll need to remove it from your repo’s history. This could be done using
git rebaseas described in the answers to these questions (for example):After you removed the commit from the history, you could
git push -f githuband thengit push -f heroku.Note that
git push -fcould cause problems if someone fetched the state of your github repo since your last push. See chapter The Perils of Rebasing in the progit book for an explanation why.