0

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?

dunxd
  • 930
  • 3
  • 14
  • 26
  • What were the output of those commands? From what you've said, at least one of them _must_ have failed and printed an error. If the `git filter-repo` succeeded, `git push origin` would not have worked. If `git push origin` succeeded, `git filter-repo` must not have successfully rewritten the history. – Brian61354270 Apr 21 '23 at 13:34
  • 2
    https://stackoverflow.com/a/32840254/7976758 "*If you pushed to GitHub, **force pushing is not enough**, delete the repository or **contact support***" – phd Apr 21 '23 at 13:37
  • @phd I guess that is the issue, as there weren't any error messages. I have changed the login details, and learnt a lesson. I don't think I really need to get GitHub support involved for this. – dunxd Apr 21 '23 at 14:54
  • Then the file stucks and will be available at GH for some time until garbage collector removes it. – phd Apr 21 '23 at 15:34

1 Answers1

-1

I would try branching what you currently have without the sensitive information and then possibly trying git revert on the branch with the sensitive data

paradoxl
  • 1
  • 1