Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Remove file from all history

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

0 votes
Answer accepted
Patrik S Atlassian Team 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
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,216 views 2 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you