4

I want to completely delete a commit I made to GitHub I've used git-filter-branch as described here and now the branch's history is replaced with different commits and the old commit is not discoverable by searching the history

Yet - a link I have to the old commit is still valid and still leads me to the data I wanted to delete on Github

Is there a way to remove this commit from GitHub and/or invalidate all access to it?

Eliktz
  • 572
  • 1
  • 4
  • 27
  • 2
    as that page says, `You can't do anything about existing clones or forks of your repository, but you can permanently remove cached views and references to the sensitive data in pull requests on GitHub by contacting GitHub Support or GitHub Premium Support.` -- have you tried contacting them? – TZHX Aug 22 '19 at 08:08
  • Related: [Delete commits from a branch in Git](https://stackoverflow.com/questions/1338728/delete-commits-from-a-branch-in-git) – sleske Aug 22 '19 at 08:09
  • @TZHX: That's basically the answer, isn't it? Consider adding it as an answer :-). tl;dr: You cannot fully remove an old commit from Github, sorry. – sleske Aug 22 '19 at 08:12
  • Possible duplicate of [Remove sensitive files and their commits from Git history](https://stackoverflow.com/questions/872565/remove-sensitive-files-and-their-commits-from-git-history) – phd Aug 22 '19 at 10:41
  • https://stackoverflow.com/a/32840254/7976758 – phd Aug 22 '19 at 10:41
  • https://stackoverflow.com/search?q=%5Bgithub%5D+remove+sensitive+data – phd Aug 22 '19 at 10:41

1 Answers1

2

The key is in this paragraph:

It's important to note that those commits may still be accessible in any clones or forks of your repository, directly via their SHA-1 hashes in cached views on GitHub, and through any pull requests that reference them. You can't do anything about existing clones or forks of your repository, but you can permanently remove cached views and references to the sensitive data in pull requests on GitHub by contacting GitHub Support or GitHub Premium Support.

A key point about Git in general is commits aren't really deleted even if you're using something like filter-branch. Instead, new commits are created that have the same changes but with the sensitive data filtered out. This is the case for nearly any operation in Git—rebasing, cherry-pick, etc. commits don't get destroyed, just new ones get created. So the best bet here is to contact GitHub support and see if they can help you purge that commit from the repo given that there are no references to it (ex. a branch).

rb612
  • 5,280
  • 3
  • 30
  • 68