File size: 1,094 Bytes
6371d28 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | # Remove binary data from Git history so HF Space push succeeds.
# Run from repo root: .\scripts\fix_push_no_binaries.ps1
$ErrorActionPreference = "Stop"
Set-Location $PSScriptRoot\..
Write-Host "Creating new branch with no history (no binary files)..." -ForegroundColor Cyan
git checkout --orphan temp-main
git reset
Write-Host "Staging only non-ignored files (data/ and hf_dataset/ are in .gitignore)..." -ForegroundColor Cyan
git add .
$status = git status --short
if ($status -match "data/|hf_dataset/") {
Write-Host "ERROR: data/ or hf_dataset/ are still staged. Remove them from the index and try again." -ForegroundColor Red
git checkout main
git branch -D temp-main
exit 1
}
Write-Host "Committing..." -ForegroundColor Cyan
git commit -m "Space: app only, no binary data (push-friendly)"
Write-Host "Replacing main with clean history..." -ForegroundColor Cyan
git branch -D main
git branch -m main
Write-Host "Pushing (force) to origin main..." -ForegroundColor Cyan
git push -f origin main
Write-Host "Done. Push should have succeeded." -ForegroundColor Green
|