My company currently uses BitBucket Data Center v9.4.2. My team has a project that is source controlled with a Git repository on BitBucket. We are planning to start using Git LFS because we want to source control some larger binary files.My questions are:
I have seen some answers, but they are related to either Cloud or Server:* [1]https://community.atlassian.com/forums/Bitbucket-questions/How-to-delete-old-lfs-files-from-a-fork/qaq-p/2892902* [2]https://community.atlassian.com/forums/Bitbucket-questions/Delete-Git-LFS-files/qaq-p/863172Thank you!
For Bitbucket Data Center (including 9.4.2), there are two different things to consider:
Removing LFS files from Git history
Use a history‑rewrite tool locally (for example, BFG, git filter-repo, or git filter-branch) to remove the LFS‑tracked files or pointers from the commits.
git filter-repo
git filter-branch
Then force‑push the cleaned history to Bitbucket.
This removes the pointers from the repository’s history, but does not delete the underlying LFS objects from Bitbucket’s LFS storage.
Deleting LFS objects from Bitbucket’s storage
Bitbucket Data Center’s embedded LFS store doesn’t provide a supported way to delete individual LFS objects for a repo.
The only supported way to delete all LFS objects for a repository is to delete the Bitbucket repository itself.
When the docs/community answer say “delete and recreate the repository”, they mean your normal Bitbucket Git repository (the one under <project>/<repo> in the UI). Deleting that repo also removes its LFS data from $BITBUCKET_HOME/shared/data/git-lfs/storage.
<project>/<repo>
$BITBUCKET_HOME/shared/data/git-lfs/storage
So in practice:
If you want to stop using certain LFS files and keep the repo: rewrite history to remove the pointers; the LFS blobs will still exist on disk.
If you need to thoroughly purge LFS data for that repo from Bitbucket: back up, delete the repo in Bitbucket, recreate it, and push a cleaned history without those LFS files.
Interesting related reads:
LFS User Stories: Bitbucket Server
Delete Git LFS files
How to find the LFS store disk usage for each LFS-enabled repository in Bitbucket Data Center | Bitbucket Data Center | Atlassian Support
Git Large File Storage | Bitbucket Data Center 9.3 | Atlassian Documentation
It looks like you're new here. Sign in or register to get started.