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

Bitbucket repo has 2.1 GB size

Aj De Guzman October 21, 2020

Okay, so our current situation is that we are required to always include the JAR file as it is the file that is being deployed in the cloud. Problem is it keeps on growing the size of the repo which makes us keep on requesting a support to garbage collect the repo. Are there any solutions where in git does not track the history of the JAR file and it should always overwrite what is on the repo?

2 answers

1 vote
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 26, 2020

Hello,

If you don't need to track the history of this jar file, a suggestion I can make is the following:

1. Rewrite history in the repo to remove this file from the repo's history (a git gc will be needed on the remote repo, after you do this and push)

Please note when you rewrite history, the commit hashes will change. As a result, pull requests that reference such commits whose hash has been changed, will lose the info related to those commits, and also any comments. If you would like to keep the pull request history, we suggest that you push the clean version of your repo to a newly created repo.

You can find more info on file removal from Git history here: https://support.atlassian.com/bitbucket-cloud/docs/maintain-a-git-repository/


2. Upload the jar file to the 'Downloads' section of the repository. You can do so either via the UI, or via API

If you upload a file with the same name as an existing file in the 'Downloads' section, then the existing file will be replaced.

For purposes of deployment, you can retrieve the file via API:

An example call:

curl --request GET -L --user user:password https://api.bitbucket.org/2.0/repositories/workspace-id/repo-slug/downloads/my_file.jar --output my_file.jar

Kind regards,
Theodora

Julius Davies _bit-booster_com_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 26, 2020

Git-lfs is also a decent approach to this problem.

Like Theodora Boudale likes this
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 28, 2020

Indeed, in case the jar file needs to be versioned, Git LFS can be used.

This way the jar file will be stored in a remote server, and the git repo will contain a pointer to this file.

@Aj De Guzman for your reference:

https://support.atlassian.com/bitbucket-cloud/docs/manage-large-files-with-git-large-file-storage-lfs/

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

0 votes
Julius Davies _bit-booster_com_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 23, 2020

 

If you store the jar file unzipped in git that will dramatically reduce disk usage. 

Not intuitive I know but it works because by unzipping the jar before committing it allows git to run its powerful de-duplication logic against the files inside the jar file.  If files inside don't change between versions they won't take up any new space. 

Whereas storing the jar file directly means every inner file always requires disk even if they don't change between versions.  

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events