Go to TogaWare.com Home Page. GNU/Linux Desktop Survival Guide
by Graham Williams
Duck Duck Go

Remove all Traces of a File


You can not actually guarantee to remove all traces of a file you uploaded to github because anyone may have downloaded, cloned, or forked your file. However, if you are quick enough you can limit the risk. The typical use case is when you have accidentally uploaded a file containing secret information, such as a password. Here is how we remove all traces of a file named private.py from github's repository.

$ git filter-branch --force --index-filter \
  'git rm --cached --ignore-unmatch private.py' \
  --prune-empty --tag-name-filter cat -- --all
$ git push --all --force


Copyright © 1995-2019 Togaware Pty Ltd
Support further development through the purchase of the PDF version of the book.
Brought to you by Togaware and the author of open source software including Rattle and wajig.
Also the author of Data Mining with Rattle and Essentials of Data Science.