I have a Bitbucket repository where I store some *.html, *.css, *.js files.
Part of this repository - about 60 *.json files, each about 1-3MB size.
These files are changed 3 times per day, so there are 3 commits every day.
And I do not need old versions of these *.json files - only the most recent version.
These *.json files create problems: Git repository grows with the time!
Attempts to delete old versions of the *.json files (with BFG tool and "git gc/prune") can not be fully automated - unfortunately I have to ask Bitbucket admins to run "git gc" on their servers (after running BFG on my machine).
And, actually, I do not need version control for these *.json files at all.
They just should be stored (somewhere in or near the repository)
THE QUESTION:
Is Git LFS a good idea for such *.json files?
Imagine Git LFS will be used - can I completely delete/purge old versions of the files by myself? (without asking Bitbucket admins to run "git gc" on their servers)
Imagine I run some (Git LFS) commands (a cronjob with commands similar to "git gc") every day.
Would it help keeping the repository size constant?
Hey @stargazer33 ,
Thank you for reaching out to Atlassian Community!
The files configured to be stored in LFS will continue to be tracked over history, the difference is that LFS is separate storage so those files are not counted against your repository size limit. Your git repository will just keep a pointer to the actual file in the LFS storage.
However, LFS storage also has a size limit depending that depends on your bitbucket plan (see Storage policy for Git LFS for Bitbucket )
The LFS files can be manually deleted on the UI by accessing Repository Settings > LFS > ( ... ) On the right side of the file > Delete file. Unfortunately, we currently do not have a way to bulk delete the LFS files, and they can only be deleted one by one from the UI. Please note that deleting LFS files has some implications when checking out versions of the code that had their LFS files deleted - you can learn more about those implications in our Delete Git LFS files documentation.
An alternative for deleting all the LFS files is when you are reaching the LFS size limit, you can delete the repository in Bitbucket, run BFG to your local clone in order to delete the old version of the files, and then re-create the repo and push it to Bitbucket. This should make the remote repo only have the last version of the LFS files.
Lastly, as you mentioned that you are not interested in tracking the history of those files, another option is to use the Downloads section of the repository. You can upload, download and delete files from the Downloads section by using the Bitbucket Cloud API, which gives the possibility for you to build a script for automation. The relevant API endpoints are listed in the following link :
Thank you, @stargazer33 !
Patrik S
Patrik, thanks for detailed response!
I think, these *.json files will be stored somewhere... not in Git.
Version tracking is not required -> Git is not a right place for such files...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.