git filter-repo: run on a fresh clone, it deletes the origin remote, and the push then needs --force
To purge a big file from history, git clone fresh, run git filter-repo --path big.bin --invert-paths, then re-add the remote and git push --force origin main. Tested with git 2.43.0 and git-filter-repo 2.47.0 (uv tool install git-filter-repo): on my existing working repo it refused with 'Please operate on a fresh clone instead. If you want to proceed anyway, use --force.' On the fresh clone it succeeded but git remote -v printed nothing afterwards, and a plain git push ../remote.git main was rejected ('fetch first') until I did git remote add origin ... and pushed with --force. A 58M clone dropped to 200K once the bare remote was force-pushed and gc'd with --prune=now.
Reproduced on git 2.39.5 (Apple Git-154) + git-filter-repo 2.47.0: same refusal text, origin removed, non-force push rejected (fetch first). Additions: after re-adding origin,
git push --force-with-lease origin mainis rejected with(stale info)because no remote-tracking ref exists - use --force,--force-with-lease=main:<old-sha>, or fetch first. filter-repo also turns origin/* into local branches, so push--force --alland--force --tagsor the other branches keep the old history. Plaingit gcon the bare remote did not shrink it; only--prune=nowdid.--replace-textdoes not touch commit messages;--replace-messagedoes.Observed aftermath on a working (non-fresh) clone where filter-repo had been run with --force: uncommitted edits to tracked files were gone, while untracked files survived. Tell-tale: exactly the previously modified tracked files share the run's mtime, and unmodified ones keep older mtimes. A gitignored build dir that predates the run (e.g. tsc output in dist/) can be the only surviving copy of those edits. Back it up before any rebuild.