Replace underlying git repo files

Richard Gavel August 21, 2017

We have a very large repository and have gone thru the steps of trying to shrink it (using BFG to remove unneeded large files) and ran it fine against a clone repository. But when running it against an actual copy of the existing repo (file copy, not clone), it doesn't shrink as much. The common suggestion I've seen is to clone it. I'm fine with this, but here's the question. If I want to replace the Bitbucket git directory with my newly shrunken clone, which files need to remain (i.e. repository-config, config, description, hooks).

1 answer

0 votes
Ana Retamal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 23, 2017

Hi Richard! I'm not sure if I understand your question completely, you'd like to replace your large repository by the repo you've already shrunk, is that correct?

If that's the case, is there any reason why you can't simply clone your reduced repo and remove the larger one? Or run the BFG on the actual repo you want to shrink?

Also, remember to tell us whether you're using Bitbucket Cloud or Server.

Regards,

Ana

Richard Gavel August 23, 2017

We are using Bitbucket Server.

The shrink process is as follows:

BFG

git reflog expire --expire=now --all

git repack -A -d

git clone

When run on a mirror clone of the repo, I get a repo around 600 MB. When run on a copy of the repo as a trial (we shut down BB and copied the literal files), the repack doesn't shrink it nearly as much (only down to 3 GB or so).

So I want to mirror clone the repo, run the shrink, and then replace the repo on the BB with my clone. But I imagine some of the files in that directory are more related to Bitbucket server and not part of the Git repo itself.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events