0

I would like to know if there's a way to actually delete a commit from a remote Git repository. I have committed (and pushed) sensitive data, so I used the obvious

git reset HEAD^
git push -f

To rewrite the branch with what was there before, but if I try to access the former commit's page (on GitLab) using its hash, I still see its contents (even if it's referenced nowhere).

I tried running "housekeeping" (which to my understanding should remove this) but it didn't.

Any ideas?

phd
  • 82,685
  • 13
  • 120
  • 165
Thomas Kowalski
  • 1,995
  • 4
  • 20
  • 42
  • 1
    It will eventually be garbage collected, depending on your repo's settings. Are you concerned that it would be accessed in the meantime? How other than by commit hash would it be? – Romain Valeri Nov 04 '19 at 09:36
  • Well, uniquely by commit hash but with CI / CD it might already have leaked in some logs – Thomas Kowalski Nov 04 '19 at 10:05
  • If the commit hash is out, all its contents are already spilled out, anyone could cat-file it to read its contents. – Romain Valeri Nov 04 '19 at 10:15
  • 1
    Same as this https://stackoverflow.com/questions/5816688/resetting-remote-to-a-certain-commit – Mohit Mutha Nov 04 '19 at 10:30
  • 2
    Possible duplicate of [Accidentally committed sensitive information - GitLab](https://stackoverflow.com/questions/53560337/accidentally-committed-sensitive-information-gitlab) – phd Nov 04 '19 at 11:54
  • 1
    https://stackoverflow.com/search?q=%5Bgitlab%5D+remove+sensitive+data – phd Nov 04 '19 at 11:54
  • https://stackoverflow.com/search?q=%5Bgithub%5D+remove+sensitive+data – phd Nov 04 '19 at 11:54

0 Answers0