| # 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 | |