Reputation: 392
I am working with a large text file that exceeds the maximum allowable file size that git allows, so it's not allowing me to push my local commits to remote. I've tried creating a .gitignore file and adding the path of the file to it, but I still get the same problem.
I've also tried:
git rm -r --cached .
git add .
git commit -m "message"
git push
As well as:
git update-index --assume-unchanged <path/to/file>
I've even deleted the file then re-commit and push:
git add .
git commit -m "message"
git push
but git still thinks I'm trying to push the large text file. I'm stumped as to how I can un-track the file from git.
Upvotes: 4
Views: 1130
Reputation: 1417
Note : git rm --cached
unstage only from the index, not from the repository.
The text file has already been registered in a previous commit in your repository. Even if you try to modify your repository with new commits, the old one is still there. Git will try to push it anyway.
So you need to edit this previous commit and remove the file registered in it. You have to rewrite the history of the commits : git rebase -i specific-commit-id
will be your friend. At this point, you can use git rm --cached
to remove the big text file in this commit. Then git commit
to update it.
Upvotes: 2