# Push Reject due to Binary Files

**URL:** <https://discuss.huggingface.co/t/push-reject-due-to-binary-files/88990>\
**Category:** Spaces\
**Created:** [May 28, 2024, 2:30pm UTC](https://discuss.huggingface.co/t/push-reject-due-to-binary-files/88990 "2024-05-28T14:30:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Utkarsh736](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/utkarsh736/32/28201_2.png) [@Utkarsh736](https://discuss.huggingface.co/u/Utkarsh736)\
**Post date:** [May 28, 2024, 2:30pm UTC](https://discuss.huggingface.co/t/push-reject-due-to-binary-files/88990/1 "2024-05-28T14:30:00Z")

</div>

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:

```bash
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?

---

<div class="post-metadata">

**Author:** ![Utkarsh736](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/utkarsh736/32/28201_2.png) [@Utkarsh736](https://discuss.huggingface.co/u/Utkarsh736)\
**Post date:** [June 12, 2024, 1:35pm UTC](https://discuss.huggingface.co/t/push-reject-due-to-binary-files/88990/2 "2024-06-12T13:35:40Z")

</div>

The above issue was resolved with the help of a similar previous issue.  
Link - [Git LFS fail for Spaces with Github Workflow](https://discuss.huggingface.co/t/git-lfs-fail-for-spaces-with-github-workflow/16642)

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](https://discuss.huggingface.co/t/git-lfs-fail-for-spaces-with-github-workflow/16642/7)

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png) [@system](https://discuss.huggingface.co/u/system)\
**Post date:** [June 14, 2024, 4:59pm UTC](https://discuss.huggingface.co/t/push-reject-due-to-binary-files/88990/3 "2024-06-14T16:59:17Z")

</div>

Closed on June 14, 2024, 4:59pm UTC

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