Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Converting repository to use LFS with BFG

alata
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 20, 2019

I've been trying to convert a repository that we currently have to use LFS to store large blob files. I found an article here: https://confluence.atlassian.com/bitbucket/use-bfg-to-migrate-a-repo-to-git-lfs-834233484.html but this article does not seems to work entirely. I did step A, which did not seem to change anything (even though it shows an uploading prompt at the git bash terminal). Step B seems to move the files in HEAD to LFS storage, but after I'm done with this step I still have ~500mb of blob files in my git history that have not been updated.

After this I attempted to follow the instructions given by the support article at the BFG creator's repository (https://github.com/rtyley/bfg-repo-cleaner/releases/tag/v1.12.5), and while the 

git reflog expire --expire=now --all && git gc --prune=now

command seems to move these historical large blobs into LFS storage, it does not prune them from my git history and my repo size remains very large. After using these steps my LFS storage has the appropriate size, but the repo size remains the same and is now about the same size as the LFS files.

The instructions given on the Atlassian support page are vague to say the least. In the article shown at https://confluence.atlassian.com/bitbucket/use-bfg-to-migrate-a-repo-to-git-lfs-834233484.html I have several questions:

- In step A3 should I be running this command from outside of the <repo-name>.git folder?
- After step A3 why am I not told to run 

git reflog expire --expire=now --all && git gc --prune=now

to clean the history of the git repository with references to LFS where these large files existed in the history?

- After step A5 I am assuming that I should `cd ..` to get out of the <name>.git folder and clone the repository normally with 

git clone git@bitbucket.org:<username>/<repo-name>.git

before setting up LFS locally using the instructions linked in step B2.

- After all of this I've gathered (from BFG documentation) that these large files still exist in my main git repository code but only in the HEAD commit. I assume that B2 is to change that for the HEAD of my repository (on master), which it seems like it did. None of these steps, however, have removed large blob files from my git history as it was advertised. It seems that these files have just been copied to an LFS store while they still remain clogging up the Git repo. Is there any way to migrate these historical blobs to LFS storage? We have a repository that is currently ~1.6GB in size that we need to reduce as soon as possible.

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events