Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

I removed the large file from bitbucket but still repo size is too large

Ahmed Shoeib February 27, 2020

My Repo Size is now 1.68 GB I removed the large file from all branched from bitbucket locally and remote but still repo size is too large.

Can you please advice how i can clean my remote repo to get the actual repo size?

2 answers

1 vote
Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 27, 2020

Hello @Ahmed Shoeib,

Welcome to the Community.

I just ran aggressive garbage collection in your repository, and its size dropped to 1.3 GB. Not sure what was its size before you added that large file. If it is still in the history, you need to rewrite history to remove it completely like @DPKJ suggested above.

Let me know if you have any questions.

Cheers,
Daniil

Ahmed Shoeib February 27, 2020

@Daniil Penkin  Can i get which files causing my repo size to be 1.3 GB ?

Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 27, 2020

Yes. There're several ways to do that, here's the one we suggest with a guide.

Ahmed Shoeib March 1, 2020

@Daniil Penkin  i got the large file using below  command fro the link you shared but can i get also which branch has this files 

$ git_find_big.sh 
Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 2, 2020

In general it is impossible to say which branch introduced the file, unless your commit graph is very simple. Branch in Git is just a pointer to a commit, once you create another commit on top of that, the pointer is moved. When you merge branches, it is impossible to say, which parent of the merge commit was on which branch.

However you can find commits that modified that big file, then find all current branches (and tags) that have those commits in their history (e.g. commit is reachable from the commit at the brach pointer). Something like this should show all commits for the given file path:

 git log --oneline --branches -- path/to/file

You'll then need to rewrite history up to the first commit that introduced that file (in case you want to completely remove it from history). See this section of Pro Git book for details.

Cheers,
Daniil

0 votes
DPKJ
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 27, 2020

@Ahmed Shoeib  Welcome to the community!

Sometimes, some files stay attached in history or Bitbucket periodic cache clean has not kicked in yet to show you size related changes.

At this stage you can use tools like,

You must also read this KB article by Atlassian - https://confluence.atlassian.com/bitbucket/reduce-repository-size-321848262.html

Ahmed Shoeib February 27, 2020

@DPKJ  this tool will clean the local repo or the remote one because i tried this before but i didn't get how it works 

DPKJ
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 27, 2020

I suggest you go through Atlassian's KB post that I mentioned, and meanwhile I will try and find some usage link for you.

DPKJ
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 27, 2020

Here is another important post, this was in my bookmark and I have used to remove file permanently and reduce repo size - https://confluence.atlassian.com/bitbucket/maintaining-a-git-repository-321848291.html

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events