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
4,361,127
Community Members
 
Community Events
168
Community Groups

Delete the large files from repository

Edited

I have mistakenly committed the big files/folder in the repo and now the size of repo became 1.6GB, the actual size was around 75MB. I want to delete that folder from the repo. but it's not showing in the account or when I clone it again it is not there.

I want to reduce the size of the repo, can someone please help?

Repository name: appliedgeochemists.org

1 answer

1 accepted

0 votes
Answer accepted

Hello,

I assume that the repository is hosted in Bitbucket Cloud (https://bitbucket.org/)?

Can you check the commits in Bitbucket website to find which commit contains these big files/folder?

If the commit that contains these large files is the last commit on a certain branch (no one else has pushed more commits to this branch), you can do a git reset on this branch, back to the commit before the large files were introduced, and force push this to Bitbucket.

In case the commit that contains these large files/folder is not the last commit on a certain branch and other people have pushed more commits, I would recommend rewriting repo history with a tool like BFG (https://rtyley.github.io/bfg-repo-cleaner/) to remove the large files/folder.

Please make sure to take a backup of the repo before either operation (since both include destructive operations) and communicate any steps you take with your team. Your team members may need to take a fresh clone of the repo afterwards if they have pulled the commit that has the large files/folder, so that they don't accidentally push this commit back.

Please also note that in both cases a git gc will be needed on the remote repo after you push your changes to Bitbucket, in order for the repo's size to get reduced. Feel free to let me know and I can run the git gc for you.

Please feel free to let me know if you have any questions.

Kind regards,
Theodora

Hello, Thank you for the response.

Actually that commit had made by a team member, and while checking it in the commits I am unable to find out that commit and there is only one branch master.
commit that included ./images (/images/Explore, /images/stories), that has over 1GB of images and pdfs. These need to be removed.

When I am cloning the repo again it is not showing these big files/folder in it. please help me to delete these big files I am new to the bitbucket.

Thank you.

Hello,

I checked your account in our system, I found the repository with the name that you provided and I ran a git gc on it. After I ran the git gc, the repo's size is now 67.3 MB.

Since you mentioned that you couldn't find this commit and files, I believe that one of your colleagues may have already removed the problematic commit from the repo's history.

In this case, the commit remains on the remote repo as a dangling commit until a git gc runs, which I believe is the reason why the repo's size was showing as 1.7 GB.

Can you check the repo's size in the Repository settings and confirm if things are ok now?

Kind regards,
Theodora

Yes, I have checked the repository size, and its fine now.

Thank you so much for the help.

Regards,

Sunny

Hi Sunny,

That's good to hear and you are very welcome! I'm glad this is sorted out now.

Kind regards,
Theodora

Hi @Theodora Boudale ,

I have an issue with another repository and posted it here https://community.atlassian.com/t5/Bitbucket-questions/Delete-large-file-from-the-repository/qaq-p/1869681 but yet not gotten any response, can you please help me with this?

Thank you.

Suggest an answer

Log in or Sign up to answer
TAGS
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...

3,487 views 3 10
Read article

Atlassian Community Events