In the past I've used git filter-branch to remove files from my git history. Following that, I can do a force push to update the remote repository. For example, removing all HTML files from the local repo and then rewriting the remote to reflect the change:
$ git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch -r \*.html' --prune-empty -- --all
$ git push origin --force --all
This works perfectly fine. But seeing as filter-branch is extremely slow and has been deprecated for a while, I'd like to do this with git-filter-repo instead. So far, this seems to be the equivalent command:
$ git-filter-repo --force --path-glob *.html --invert-paths
This first step appears to work. My issue is when I attempt a force push afterwards, I see my remotes have been lost.
$ git push origin --force --all
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
The filter-repo command appears to have removed my remote URLs when I check git remote -v. Adding back the remote manually puts me down a rabbit hole of other settings be invalid.
Why does git-filter-repo remove my remote? And how can I rewrite remote's history using git-filter-repo like I'm able to with git filter-branch?