xxxxxxxxxx
# remove from local indexing
git rm -r --cached .
# remove actual files from remote repo
git add .
git commit -am "Remove ignored files"
git push -f origin main
xxxxxxxxxx
git ls-files -i --exclude-from=.gitignore | %{git rm --cached $_}
// works with windows powershell
xxxxxxxxxx
git ls-files -i -z --exclude-from=.gitignore | xargs -0 git rm --cached
xxxxxxxxxx
git ls-files --ignored --exclude-standard -z | xargs -0 git rm --cached
git commit -am "Remove ignored files"
// answer from: thSoft