0

We have a large repository with 280 gigabytes. We wanted to reduce this repository using Gitlab and Git lfs by tracking some files and moving them to the lfs storage. However, this only worked to a limited extent because although the files that were tracked were moved to lfs and replaced by pointers, the overall repo size increased from 280 GB to 500Gb.

Our goal was to reduce the repo size. What did we do wrong, or is it even possible using git lfs? It is also important to us to retain the existing history.

What have we done?

git lfs install
git clone <repository-url>
git lfs track "*.iso"
git add <file>
git commit -m "Add large files with Git LFS"
git push origin main
git lfs migrate import --include="*.iso"
git add .
git commit -m "Migrate existing large files to Git LFS"
git push origin main
2
  • 1
    You have now told git to track the big files in lfs going forward, but you have not removed them from the git history. You need to delete the files from your git history as well (see stackoverflow.com/questions/43762338/… but use caution). My guess to why your clone increased in size is that now you have the complete history of the files in your clone in addition to one LFS copy. Removing the files from git history should limit it to the LFS copy and those with no need for the .iso files can chose to not download them. Commented Aug 29, 2024 at 9:24
  • Thanks for your comment, do I understand correctly that if I delete the ISO data from the history, the pointer files are still included in the history? Commented Aug 30, 2024 at 9:30

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.