0

Git will not let me push an update to my remote branch because a file is too large. I don't even need to file so I've deleted it. I still get the same error. I added this file to my .gitignore file and to my .gitattribute file for git lfs and I'm still getting the same error. I just want to get rid of this huge file so I can update my remote branch. But, I have no idea where or where it is causing a problem. None of the solutions in the post below worked: Can't push to GitHub because of large file which I already deleted

C:>git push -u origin localbranch

Enumerating objects: 55, done.
Counting objects: 100% (55/55), done.
Delta compression using up to 12 threads
Compressing objects: 100% (36/36), done.
Writing objects: 100% (47/47), 29.97 MiB | 13.67 MiB/s, done.
Total 47 (delta 15), reused 34 (delta 7), pack-reused 0
remote: Resolving deltas: 100% (15/15), completed with 6 local objects.
remote: error: Trace: 4141414
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File file.csv is 182.47 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
To https://github.com/billybabis/data.git
 ! [remote rejected] localbranch -> localbranch (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/billybabis/data.git'


C: >git rm -r --cached file.csv
fatal: pathspec 'file.csv' did not match any files
  • 1
    `git rm` only removes the file from the current commit. `git push` must send the whole commit history which still contains the file. The file must be eliminated from history; see [the duplicate question](https://stackoverflow.com/questions/2100907/how-to-remove-delete-a-large-file-from-commit-history-in-the-git-repository) for how to do that. – Schwern Jun 17 '22 at 19:13
  • Check the answer with 3 upvotes at: https://stackoverflow.com/questions/2047465/how-can-i-delete-a-file-from-a-git-repository I think it'll help you. – raddevus Jun 17 '22 at 19:16
  • I'm running the following command as suggested in that post and it does not work: > git filter-branch --tree-filter 'rm -f file.csv' HEAD fatal: ambiguous argument 'file.csv'': unknown revision or path not in the working tree. – Billy Babis Jun 17 '22 at 19:23
  • 1
    @raddevus thanks for responding. I'm afraid git rm and git rm --cached don't do anything because the file doesn't exist in either – Billy Babis Jun 17 '22 at 19:26

1 Answers1

-2

We probably need the exact error you see from Git, but it could be as simple as the fact that you need to remove the file from the Git tracked file list.

To remove the file completely (from the actual repo) try this:

c:\> git rm -r --cached <your-file-name>

Keep in mind that this will remove the file entirely.

Remember that you have to do this because just deleting a file only deletes the file from the file system, not the git repo.

raddevus
  • 8,142
  • 7
  • 66
  • 87
  • 1
    Thanks for trying to help. I tried that and it couldn't find the file in the cache either. Adding the full error log to the question now – Billy Babis Jun 17 '22 at 19:06