Git LFS fail for Spaces with Github Workflow

I am trying to setup Github Workflow for a Hugging Face space.
But I receive following error message:

remote: -------------------------------------------------------------------------        
remote: Your push was rejected because it contains binary files.        
remote: Please use to store binary files.        
remote: See also:        
remote: -------------------------------------------------------------------------        
remote: Offending files:        
remote:  - ballon.jpg (ref: refs/heads/main)        
remote:  - fountain.jpg (ref: refs/heads/main)        
remote:  - wolf.jpg (ref: refs/heads/main)        
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to ''
Error: Process completed with exit code 1.

Modified Code I tried:

name: Sync to Hugging Face hub
    branches: [main]

  # to run this workflow manually from the Actions tab

    runs-on: ubuntu-latest
      - uses: actions/checkout@v2
          fetch-depth: 0
          lfs: true
      - name: Checkout LFS objects
        run: git lfs checkout
      - name: Push to hub
          HF_TOKEN: ${{ secrets.HF_TOKEN }}
        run: git push --force https://satpalsr:$ main

Hey there! As per the error message, the binary files should be tracked with git lfs.

What you can do is

# Track the files being rejected
git lfs track "your_file" # or *.your_extension

# Track things 
git lfs install

Note that if you have commits with those files, it will still be rejected since the binary files are in previous commits without git lfs, so you will need to change that.

1 Like

Not working!
Added these lines & even created a new test space.
Though the .jpg files are tracked successfully, the exact same error message repeats.

To reproduce:

  1. Create a test space at Hugging Face.
  2. Create a repository on Github.
  3. Add a secret HF token in the Github repo.
  4. Add some image files to the Github repo.
  5. Set up the GitHub action workflow.

if the git repo is public, can you zip the whole repo (including .git) and share it somewhere? Thanks!

Hey @julien-c , here is what you need:
Github Repo:
Github repo zip (including .git) : Check DM
Space Link: