Reducing GIT repository size in STASH

I have a git repository that was converted from a subversion repository that had lots of binaries checked in. I thought I had gotten all of them before doing the initial push to stash but it turns out I was wrong.

I have followed the guide here: remove the binary files which lowered the repository size from ~2.7gb to ~340mb. I then force pushed the repository up to stash.

However, when I do an initial clone from stash, it still downloads ~2.5gb of files. Once the clone is finished, I can then run "git gc --prune=now" to get the filesize back to ~340mb. This leads me to believe there are some references to the large files which need to be removed on the server, which do not come with a "git clone". My initial thought is it could be related to our merged pull requests.

I did also try manually running the "git gc --prune=now" on the server, but this did not seem have any affect.

3 answers

Since we don't care to much about our pull request history, I just created a new repository with the same name as the old one, and pushed the smaller repo up to it instead.

git gc --aggressive on the server should help, if it completes without running out of RAM.

John, when I converted from SVN we had stored lots of binaries as well. I used this really great free tool to help purge my binaries before I converted the SVN repo. It may not be too late for you to use?

BFG Repo Cleaner

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 14, 2019 in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder :  #!/bin/bash source "$(dirname "$0")/" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

257 views 0 12
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you