I realised that I included some login data in an earlier version of a project I am working on.
project/project-v1/secret.txt
I replaced project-v1 with project-v2 and stopped using the secrets file, so the main branch no longer contains project-v1 at all.
When I realised that I didn't want the secrets file visible in github, even though it can only be seen when looking at older commits, I tried to remove it from git and github using git filter-repo
as detailed in the GitHub docs
git filter-repo --invert-paths --path project/project-v1/secret.txt
git push origin
However I can still see the file when browsing the history in Github.
How can I fully remove this file from GitHub without scrapping my repo?