Spaces:
Sleeping
Sleeping
Commit
·
3912de6
1
Parent(s):
c0d574d
Docs: Add Git LFS troubleshooting notes to README
Browse files
README.md
CHANGED
|
@@ -9,4 +9,38 @@ app_file: app.py
|
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
| 11 |
---
|
| 12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
| 11 |
---
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
| 13 |
+
|
| 14 |
+
## Git LFS Troubleshooting Notes
|
| 15 |
+
|
| 16 |
+
This repository encountered several Git LFS issues during setup. Here's a summary for future reference:
|
| 17 |
+
|
| 18 |
+
1. **Missing LFS Objects in History:** Initial pushes failed because the branch history contained references to LFS objects (specifically `a11f8941...` related to `db5/.../data_level0.bin`) that were no longer available locally or on the remote LFS store. Attempts to rewrite history using `git filter-branch` also failed because the rewrite process itself required fetching *other* missing LFS objects.
|
| 19 |
+
* **Resolution:** We created a clean base branch (`fresh-start`) with no history (`git checkout --orphan fresh-start`), committed a placeholder file, and pushed it forcefully to the remote (`git push -u space3 fresh-start:main --force`). This reset the remote `main` branch.
|
| 20 |
+
|
| 21 |
+
2. **Importing State & Untracked Binaries:** We copied the desired file state from the old branch (`git checkout <old-branch> -- .`) into the clean `fresh-start` branch. However, the subsequent push failed because some binary files (e.g., `.png`) were included but weren't tracked by LFS according to the `.gitattributes` file *at that time*.
|
| 22 |
+
* **Resolution:**
|
| 23 |
+
* Added the necessary file patterns (e.g., `*.png filter=lfs ...`) to `.gitattributes`.
|
| 24 |
+
* Crucially, we had to ensure the commit correctly reflected this change. Amending wasn't sufficient. We used:
|
| 25 |
+
```bash
|
| 26 |
+
# Reset the commit but keep files in working dir
|
| 27 |
+
git reset HEAD~1
|
| 28 |
+
# Re-stage files, forcing re-evaluation based on current .gitattributes
|
| 29 |
+
git add --renormalize .
|
| 30 |
+
# Commit the properly processed files
|
| 31 |
+
git commit -m "Commit message"
|
| 32 |
+
# Force push the corrected commit
|
| 33 |
+
git push --force
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
3. **Ignoring Necessary Directories:** A required directory (`vector-databases-deployed`) was unintentionally ignored via `.gitignore`.
|
| 37 |
+
* **Resolution:**
|
| 38 |
+
* Removed the corresponding line from `.gitignore`.
|
| 39 |
+
* Staged the `.gitignore` file and the previously ignored directory (`git add .gitignore vector-databases-deployed/`).
|
| 40 |
+
* Committed and pushed the changes.
|
| 41 |
+
|
| 42 |
+
**Key Takeaways:**
|
| 43 |
+
|
| 44 |
+
* Pushing branches with problematic LFS history to a fresh remote can fail. Starting the remote with a clean, history-free branch is a workaround.
|
| 45 |
+
* When adding LFS tracking for existing binary files via `.gitattributes`, ensure the commit correctly converts files to LFS pointers. `git add --renormalize .` after updating `.gitattributes` and *before* committing is often necessary.
|
| 46 |
+
* Double-check `.gitignore` if expected files or directories are missing after a `git add .`.
|