@@ -13,25 +13,31 @@ jobs:
1313 uses : actions/checkout@v4
1414 with :
1515 fetch-depth : 0
16- lfs : true
1716
1817 - name : Push to Hub
1918 env :
2019 HF_TOKEN : ${{ secrets.HF_TOKEN }}
2120 run : |
22- # 1. Create a temporary branch so we don't mess with the local state
23- git checkout -b hf-sync-branch
21+ # 1. Create a temporary folder and copy everything there EXCEPT the .git history
22+ # This creates a "clean slate" without the old history that contains images
23+ mkdir temp_sync
24+ cp -ra . temp_sync/
25+ cd temp_sync
2426
25- # 2. Remove the docs folder (and any other large files) for the Space
26- # This keeps the images out of the HF Git history
27+ # 2. Remove the offending docs folder
2728 rm -rf docs/
29+ rm -rf .github/ # We don't need the workflow file on HF either
2830
29- # 3. Configure git and commit the deletions on this temporary branch
31+ # 3. Initialize a BRAND NEW git repo in this folder
32+ # This ensures there is no history of the images ever existing
33+ git init
3034 git config user.name github-actions
3135 git config user.email github-actions@github.com
36+
37+ # 4. Add everything and create a single "flat" commit
3238 git add .
33- git commit -m "Cleanup binary files for Hugging Face sync" || echo "No changes to commit "
39+ git commit -m "Initial flat commit for Hugging Face"
3440
35- # 4 . Force push the temporary branch to the HF 'main' branch
36- # Format: git push -f https://<username>:<token>@huggingface.co/spaces/<user>/<space> <local-branch>:<remote-branch>
37- git push -f https://asksunny:$HF_TOKEN@huggingface.co/spaces/asksunny/Compileo hf-sync-branch :main
41+ # 5 . Force push this single commit to Hugging Face
42+ # Since there is no history, HF's scanner will only see the current files (no images)
43+ git push -f https://asksunny:$HF_TOKEN@huggingface.co/spaces/asksunny/Compileo master :main
0 commit comments