Summary: I made a git commit that contained oversized files and, when trying to push, got the dreaded "large files" error. I restructured the repo to have a new top-level directory that no longer contains any large files, but I still get the "large files" error when trying to push. I tried various common solutions (below), but git keeps trying to push files that are outside the new top-level repo.
Details on what I did:
I manually removed the .git and .gitignore files to my desired new directory, as described here.
I confirmed that the new root directory was successfully recognized via
git rev-parse --show-toplevel
.I tried to push to the remote again (
git push origin main
), but got the errorFile <filepath> is 102.90 MB; this exceeds GitHub's file size limit of 100.00 MB
, where<filepath>
is a path inside the old directory, not the new one.I tried to remove the file from the cache via
git rm -r --cached <filepath>
(as described in the accepted answer here), but this yields the errorfatal: <filepath> is outside repository
.I reset via
git reset HEAD~
, then tried again to push, but I got the same error as above.I tried to filter the branch history to remove commits involving the large file (
stitched.csv
) viagit filter-branch --index-filter 'git rm -r --cached --ignore-unmatch stitched.csv' HEAD
, as described here. Then I tried to push again and still got same error, again referring tostitched.csv
.
In practice, I have quite a few oversized files, so I would really rather not have to remove each one from the cache manually. I have made numerous good commits since the ones that involved large files.
Any help would be much appreciated.