Push Reject due to Binary Files

Hey everyone, so I updated the code for one of my HF space
During which I had added a few images in image folder;

Then I had commited these changes, but when I tried to push the code, I got this error:

remote: -------------------------------------------------------------------------
remote: Your push was rejected because it contains binary files.
remote: Please use https://git-lfs.github.com/ to store binary files.
remote: See also: https://hf.co/docs/hub/repositories-getting-started#terminal
remote:
remote: Offending files:
remote:   - images/teddy.jpg (ref: refs/heads/main)
remote: ----------------------------------------------

Since the image files were the Offending files,
I removed them from getting tracked by git using the command
git rm -r --cached FolderName
And updated the .gitignore with the image folder.

But I still recieved the same error when trying to push, even though the image folder is no more getting tracked by git.

How may I resolve this issue?

[Additional Question]: Since I was trying to upload the images for hf space example inference, do I need to use git-lfs as recommended in the error message or is there some other way?

The above issue was resolved with the help of a similar previous issue.
Link - Git LFS fail for Spaces with Github Workflow

The issue was apparently a common error of not filtering the “offensive files” from the git history.
refer - Nevermind, found an answer to remove git history of all large file by running the following git command

Thanks to all the contributors of the earlier issue/fix.

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.