Reputation: 5307
I have be working on this repo for a long time and all of a sudden I ran into a problem. I realized I had a 350 meg .csv file. My normal procedure to push to to github was:
git add .
git commit -m "some message"
git push
When I realized it was starting to write a large file I looked at saw it was that large .csv "shifts.csv". So I deleted it and I went
git rm shifts.csv
I rewent through the process of adding, committing and pushing and it was still trying to write this large file on a push after having deleted it. Googling for a solution I can't find one.
Upvotes: 2
Views: 740
Reputation:
Git is probably still trying to push the file to your remote repo, because although
git rm shifts.csv
git commit
removes the file from the current and future state of your source code, it still exists in the repository history, in earlier commits, and therefore when you push, Git has to push all of your history to your remote still, including the commits with the file in it, because it's still part of your earlier history.
You have to somehow completely erase the file from the history of your repo, as if it never existed at any point in time. If the commit in which the file was created isn't too far back in your history, you could possibly use an interactive rebase to remove it, or do a hard reset if you don't mind losing work.
However, if the commit is buried far back in your history, then your only practical option is probably to erase the file from your history using git filter-branch
.
Upvotes: 2