I'm trying to put a Git project on GitHub but its history contains certain large files. If we try git push to GitHub, we are getting an error:
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: File .OldFiles/blah1/[file].[ext] is 257.29 MB; this exceeds GitHub Enterprise's file size limit of 100.00 MB
Our first commit(say commit_1) was containing a few large files which were removed in one subsequent commit(say commit_2) without rewriting the git commit history.
We are using AFS File System(may be an extra info) and all the old large files are stored at a specific location in .OldFiles directory.
In commit_2, we have removed .OldFiles with it's contents and also have added blah1 directory to .gitignore, but this is not removing their history within Git.
Unfortunately, we need to keep intact several other commits(literally n number of commits!) after commit_1 & commit_2.
I have tested over a clone at local sandbox by creating a duplicate branch from as commit_1:
git checkout -b fix_branch <commit_1_sha_id>
Found that fix_branch is still containing large files: .OldFiles/blah1/[file].[ext].
Maybe we need to remove these large files in OldFiles & it's respective commit histories to do a successful GitHub push.
Tried this but we are getting an error at git rebase:
error: unrecognised input
error: could not build fake ancestor
Also have tried this but failed:
git filter-branch --force --index-filter \ 'git rm --cached --ignore-unmatch [project]/.OldFiles/blah1/[file].[ext]' \ --prune-empty --tag-name-filter cat -- --all
I'm not sure whether we can use git cherry-pick as we can not discard all files in commit_1 but only these large files.
Is it possible to remove all large files traces by rewriting git history and by editing the commits by using git filter-branch and git rebase -i?
P.S. We do not have lfs or bfg installed in our project space.
A li'l help will be much appreciated to this newbie! :)