How to permanently delete a file from Git repository?

Thomas Nardone March 14, 2013

I accidentally checked in a test file with credentials in the code. I'd like to remove it completely from the Git repository, so that all history of the file is gone. Can this be done?

1 answer

0 votes
Felipevsw
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 14, 2013

Have you tried using the command git-filter-branch? I think this is the one you're looking for.

Thomas Nardone March 14, 2013

Heh, I love git. My initial response was "No, that sounds completely wrong! I don't want to filter a branch!" But you are correct, that seems to be what I want. Only one problem - I don't know how I would run this command on the BitBucket repository. Shell access is not allowed via SSH, and when I do this on my local repository, it doesn't show up as a change to push to origin.

Thomas Nardone March 14, 2013

Just to update, I tried the steps here for "Option 1: Delete files by name":

https://confluence.atlassian.com/display/BITBUCKET/Maintaining+a+Git+Repository

Now all my history is gone. Yay!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events