I accidentally uploaded documents with a password in it and I have changed it but it's still in the commit history. My knowledge with GitHub is very low so please explain so I understand what I'm doing
1 Answers
Git has tools to rewrite commit history. Please be aware that if you do this, it will not remove the file in anyone else's clone, and if anyone else does happen to have the current version of the history that does contain the documents in question, they'll have to throw it away (or at the very least you won't want to accept any pull requests from them since they'll reintroduce the original history and thus your secret files).
Please have a look at http://git-scm.com/docs/git-filter-branch.html for the details on how to actually rewrite history. There are examples for getting rid of files (Examples section); you'll want the one using --index-filter
because it's much faster. Once that is done, all that's left to do for you is git push -f
to upload the new history (-f
to confirm that you want the server to discard the old history).

- 17,870
- 3
- 59
- 51