Remove file from all history

ThePokyWizard May 30, 2022

I've had a project on BitBucket for many years, and this project, only I had access to and maintained.

In this project there is a file that has existed for years that contains information about an access token for an API, but now there will be a few more people who will help me maintain this project, and I want to remove this file from all history, to not allow these other people access to the API token.

How do I remove this file completely from the history, so that it is impossible to recover any information?

I even considered creating a new project with a copy of the current project, but with that I'll lose all the history of updates that were made.

1 answer

1 accepted

1 vote
Answer accepted
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 31, 2022

Hello @ThePokyWizard ,

Thank you for reaching out to Atlassian Community! 

In order to remove the file containing the sensitive data you have to rewrite the history, and there are two different methods/tools that help you remove the sensitive information from your repository's commit history : 

I would personally recommend using BFG Repo-cleaner as I think it's easier to use and provide you with the option to instead of deleting the sensitive file, just replace the sensitive string with another one.

Both of the methods are detailed step-by-step in the documentation below, which although is for Bitbucket Server, also applies to Bitbucket Cloud, as it's pretty much standard git commands: 

In that KB you can expand the section of each of the methods to be provided with detailed instructions for each of them. You can follow those instructions and let us know in case you run into any issues.

Hope that helps! If you have any questions, feel free to ask!

Thank you, @ThePokyWizard 

Kind regards,

Patrik S

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events