I have to remove a number of files from a git repo on gitlab.com that are tracked with Git LFS. They were automatically updated in a nightly CI build over a number of weeks and I quickly ran out of storage space.
I have followed the original documentation on cleaning up a gitlab repo, but found it to not lower the used storage space. I probably did something wrong in my attempt to not delete this file across the entire history, but just within a certain date range.
The following steps using the bfg repo cleaner instead of git-filter-repo ended up working:
(Note:
git rev-listis your friend! This was the main thing that helped me filter out exactly which objects to delete from history. It's worth looking at its options!)6.tar xzf project-backup.tar.gzgit clone --bare --mirror /path/to/project.bundleproject.gitdirectorygit remote set-url origin https://gitlab.example.com/<namespace>/<project_name>.git.jarfile from here<YYYY-MM-DD>with the start/end dates between which to scan the git repository for the file marked as<file path in repo>):<Object ID> <file path>, so just remove all instances of<file path>bfgon the repo with the given set of object IDs:java -jar bfg.jar -bi ./object_ids_to_delete.txt ./project.gitcd ./project.gitgit reflog expire --expire=now --all && git gc --prune=now --aggressive(see bfg docs)git config --unset remote.origin.mirrorgit push origin --force 'refs/heads/*'push-steps weren't necessary for me...)bfggenerates: it should be in./project.git.bfg-report/<date>/<timestamp>/object-id-map.old-new.txt