sshtel commited on
Commit
39ce399
Β·
1 Parent(s): a8c11c1

feat: restore story cover PNGs via Xet storage + migration docs

Browse files

docs: update migration guide with successful git-xet solution

docs: highlight problematic commits that caused PNG rejection issue
test: verify HF accepts push (PNG rejection fixed)

README.md CHANGED
@@ -137,3 +137,4 @@ All inference runs on the Hugging Face Space GPU. Voice samples, story text, and
137
  ## License
138
 
139
  Hackathon project. Stories are public domain.
 
 
137
  ## License
138
 
139
  Hackathon project. Stories are public domain.
140
+ test push verification
assets/covers/The_Adventures_of_Puss_in_Boots.png ADDED

Git LFS Details

  • SHA256: 8a1f5ff7f8d0462dd74a9b006a1e520b2b61ae7f5b2ac25c673aa15b63605300
  • Pointer size: 132 Bytes
  • Size of remote file: 2.11 MB
assets/covers/The_History_of_Tom_Thumb.png ADDED

Git LFS Details

  • SHA256: 2859e6627b658ee7dfa466f69c0ae0bfa4f01a80709462fcb40e6a075352dda4
  • Pointer size: 132 Bytes
  • Size of remote file: 1.81 MB
assets/covers/The_Little_Gingerbread_Man.png ADDED

Git LFS Details

  • SHA256: 8bc94d98903ab60bc58f78e43700c83450e979f01ec382d30c1363ec84f1e948
  • Pointer size: 132 Bytes
  • Size of remote file: 1.85 MB
assets/covers/The_Little_Red_Hen.png ADDED

Git LFS Details

  • SHA256: 50185751a380091fcf2ebc83f041b957efc613a9eb89eb1ede35da6f35494322
  • Pointer size: 132 Bytes
  • Size of remote file: 1.97 MB
assets/covers/The_Sleeping_Beauty.png ADDED

Git LFS Details

  • SHA256: 682d1b5c81f36bf1dc33b0672d5db5e8439eec09485e729f1a75c94d45db063d
  • Pointer size: 132 Bytes
  • Size of remote file: 1.85 MB
assets/covers/The_Story_of_the_Three_Little_Pigs.png ADDED

Git LFS Details

  • SHA256: bf5281eb87786b3db5f93aadbb5dbf4b46a337ad3d1baa0a1f2c47fcb26a6971
  • Pointer size: 132 Bytes
  • Size of remote file: 1.99 MB
assets/covers/The_Tale_of_Benjamin_Bunny.png ADDED

Git LFS Details

  • SHA256: 004d7e1d0e5a3b7c485e1e05e49ca887cde259cfe7e59bc617b0bd910a2920b2
  • Pointer size: 132 Bytes
  • Size of remote file: 1.9 MB
assets/covers/The_Tale_of_Jemima_Puddle_Duck.png ADDED

Git LFS Details

  • SHA256: 0a25fb5aa244ea2d320ff4ad95f6c1bcc0a3ab17d9488ac19eea6000b966d600
  • Pointer size: 132 Bytes
  • Size of remote file: 1.7 MB
assets/covers/The_Tale_of_Peter_Rabbit.png ADDED

Git LFS Details

  • SHA256: ffaabd157e24915dba30e61f6323fe4e32b259a5f649cd5ced3ef2b2b61b19a7
  • Pointer size: 132 Bytes
  • Size of remote file: 1.99 MB
assets/covers/The_Tale_of_Tom_Kitten.png ADDED

Git LFS Details

  • SHA256: 6e395aee3c4cd4e8d24f3ac501a31df60321f9567a0d4fe21a0449a35748de5b
  • Pointer size: 132 Bytes
  • Size of remote file: 1.97 MB
gitmigration.md ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # HuggingFace Spaces Git Migration: LFS β†’ Xet Storage
2
+
3
+ ## Problem
4
+
5
+ HuggingFace Spaces deprecated Git LFS and now requires **Xet storage** for binary files (images, audio, models, etc.).
6
+
7
+ When pushing to HF Spaces with LFS-tracked files:
8
+ ```
9
+ remote: Your push was rejected because it contains binary files.
10
+ remote: Please use https://huggingface.co/docs/hub/xet to store binary files.
11
+ ```
12
+
13
+ **Why:** HF's pre-receive hook scans git history and rejects any commits with binary files routed via LFS. It requires Xet protocol instead.
14
+
15
+ ---
16
+
17
+ ## ⚠️ Important: Problematic Commits to Clean Up
18
+
19
+ The following commits attempted to add PNG files **before git-xet was properly installed and configured**. These caused the rejection error:
20
+
21
+ - **`d9520f4`** - "feat: replace Unsplash cover URLs with local assets/covers/ PNG paths"
22
+ - **`f423e05`** - "feat: replace Unsplash cover URLs with local assets/covers/ PNG paths" (duplicate)
23
+
24
+ **Status:** βœ… These commits were cleaned up via `git-filter-repo` and PNG files were restored via proper git-xet workflow.
25
+
26
+ **For future reference:** Always ensure git-xet is installed and configured **before** committing large binary files. If this happens again:
27
+
28
+ ```bash
29
+ # Remove problematic commits from history
30
+ git filter-repo --path assets/covers/ --invert-paths --force
31
+
32
+ # Restore from backup or re-add with git-xet properly configured
33
+ # Then push
34
+ ```
35
+
36
+ ---
37
+
38
+ ## The Solution: Use git-xet
39
+
40
+ Store large binary files in git using **Xet protocol** instead of deprecated LFS.
41
+
42
+ **Why git-xet:**
43
+ - βœ… Binary files remain in git history (version-controlled)
44
+ - βœ… Standard git workflow (no special handling)
45
+ - βœ… Automatic deduplication & fast transfers
46
+ - βœ… HF officially supports and recommends it
47
+ - βœ… Works with existing `.gitattributes` configuration
48
+
49
+ ---
50
+
51
+ ## How We Fixed It (Step-by-Step)
52
+
53
+ ### Step 1: Verify git-xet is Installed
54
+ ```bash
55
+ git xet --version
56
+ # Output: git-xet 0.2.1
57
+ ```
58
+
59
+ If not installed:
60
+ ```bash
61
+ # macOS/Linux
62
+ brew install git-xet
63
+ git xet install
64
+
65
+ # Or download from: https://github.com/huggingface/xet-core/releases
66
+ ```
67
+
68
+ ### Step 2: Verify .gitattributes Configuration
69
+ Your `.gitattributes` should route binary files through LFS (git-xet intercepts):
70
+
71
+ ```
72
+ *.png filter=lfs diff=lfs merge=lfs -text
73
+ *.jpg filter=lfs diff=lfs merge=lfs -text
74
+ *.jpeg filter=lfs diff=lfs merge=lfs -text
75
+ *.wav filter=lfs diff=lfs merge=lfs -text
76
+ *.mp3 filter=lfs diff=lfs merge=lfs -text
77
+ ```
78
+
79
+ With git-xet installed, these files automatically route through **Xet protocol** instead of legacy LFS.
80
+
81
+ ### Step 3: Remove from .gitignore
82
+ If binaries are in `.gitignore`, remove them so they can be tracked:
83
+
84
+ ```bash
85
+ # Edit .gitignore and remove any lines excluding your binaries
86
+ # Example: remove "assets/covers/" line
87
+ ```
88
+
89
+ ### Step 4: Add and Commit Binaries
90
+ ```bash
91
+ git add assets/covers/
92
+ git commit -m "feat: add story cover images via Xet storage"
93
+ ```
94
+
95
+ ### Step 5: Push to HF Space
96
+ ```bash
97
+ git push steve-hf main
98
+ ```
99
+
100
+ **What happens:**
101
+ - βœ… Git detects binary files routed via `filter=lfs`
102
+ - βœ… git-xet intercepts and uses **Xet protocol** (not legacy LFS)
103
+ - βœ… Files upload via chunk-deduplication
104
+ - βœ… HF pre-receive hook accepts them (no "binary files rejected" error)
105
+
106
+ **Verification:**
107
+ ```bash
108
+ # Verify files are tracked in git
109
+ git ls-files | grep -i png
110
+
111
+ # Verify push succeeded
112
+ git log --oneline -2
113
+ ```
114
+
115
+ ---
116
+
117
+ ## Key Takeaways
118
+
119
+ | Aspect | Before | After |
120
+ |--------|--------|-------|
121
+ | **Problem** | HF rejected LFS-tracked binary files | βœ… Resolved with git-xet |
122
+ | **Git history** | Contained PNG LFS pointers | Properly tracked via Xet |
123
+ | **PNG files** | Attempted LFS upload (rejected) | Committed via Xet protocol |
124
+ | **Storage backend** | Legacy HF LFS (no longer supported) | HF Xet (official standard) |
125
+ | **Push status** | ❌ "binary files rejected" hook error | βœ… Successful push |
126
+
127
+ ---
128
+
129
+ ## Future Workflows
130
+
131
+ ### Adding New Binary Files
132
+ Once git-xet is installed and `.gitattributes` is configured, just use normal git:
133
+
134
+ ```bash
135
+ git add new_file.png
136
+ git commit -m "Add new image"
137
+ git push origin main
138
+ # Files automatically routed through Xet protocol
139
+ ```
140
+
141
+ ### Cloning the Repository
142
+ With git-xet installed, cloning and pulling works normally:
143
+
144
+ ```bash
145
+ git clone git@hf.co:spaces/sshtel/Huggingface_Hack
146
+ cd Huggingface_Hack
147
+ # Binary files auto-downloaded via Xet deduplication
148
+ ```
149
+
150
+ ### Updating Existing Binary Files
151
+ ```bash
152
+ # Modify a PNG file
153
+ # (e.g., replace cover image)
154
+
155
+ git add assets/covers/changed_image.png
156
+ git commit -m "Update cover image"
157
+ git push steve-hf main
158
+ # Only changed chunks uploaded via Xet (efficient)
159
+ ```
160
+
161
+ ---
162
+
163
+ ## Files Changed
164
+
165
+ - **Added:** `assets/covers/*.png` (10 story cover images, 19 MB total)
166
+ - Tracked in git via Xet protocol
167
+ - Routed through `filter=lfs` in `.gitattributes`
168
+ - **Created:** `gitmigration.md` (this file)
169
+ - **Kept:** `.gitattributes` (LFS syntax, git-xet intercepts)
170
+ - **Cleaned:** `.gitignore` (removed `assets/covers/` exclusion)
171
+
172
+ ---
173
+
174
+ ## References
175
+
176
+ - [HuggingFace Docs: Xet Storage with Git](https://huggingface.co/docs/hub/xet/using-xet-storage#git)
177
+ - [Git Xet Repository](https://github.com/huggingface/xet-core)
178
+ - [HF Docs: Upload Files](https://huggingface.co/docs/huggingface_hub/guides/upload)
179
+ - [Xet Protocol: Chunk Deduplication](https://huggingface.co/docs/xet/index)
180
+
181
+ ## Troubleshooting
182
+
183
+ ### "Your push was rejected because it contains binary files"
184
+ **Solution:** Ensure git-xet is installed and `.gitattributes` is configured:
185
+ ```bash
186
+ git xet --version # Verify installation
187
+ git config --global --list | grep xet # Verify config
188
+ cat .gitattributes # Verify routing rules
189
+ ```
190
+
191
+ ### Large file uploads are slow
192
+ **Solution:** git-xet has adaptive concurrency. For high-bandwidth machines:
193
+ ```bash
194
+ export HF_XET_HIGH_PERFORMANCE=1
195
+ git push
196
+ ```
197
+
198
+ ### Need to revert git-xet
199
+ ```bash
200
+ git xet uninstall
201
+ # Files in repos still work via LFS bridge (slower, but compatible)
202
+ ```