I got a warning from git lfs
that I exceeded my storage limit. Searching how to remove files from git lfs
I came accross this site https://docs.github.com/en/repositories/working-with-files/managing-large-files/removing-files-from-git-large-file-storage which recommended using $ git lfs uninstall
.
I run $ git lfs uninstall
locally on my machine as well as git lfs untrack
. I changed the .gitattributes
file and commented everthing that has to do with git lfs
. I then git add -A
and tried to push changes made to my code to my remote repo on GitHub. However, this gives me
batch response: This repository is over its data quota. Account responsible for LFS bandwidth should purchase more data packs to restore access.
Uploading LFS objects: 0% (0/2), 0 B | 0 B/s, done.
error: failed to push some refs to 'https://github.com/....git'
How would I remove git lfs
from my repository, but not the files it tracked? I do not really need it anymore, so there is no need to track the files. However, I need to keep the files!
As described in this answer, it is currently not possible to remove Git LFS objects from the remote storage in GitHub. The documentation suggests two things:
Either delete (⚠️ "any associated issues, stars, and forks are also deleted") and recreate the repository.
Or, if that is not possible, you have to contact support.
I went with option 2 a couple of days ago and here is how it went:
For future reference, here's how we usually handle the deletion of LFS objects:
To remove files from LFS tracking, we'll need to delete them from the server on our end. Deleting them from the GitHub repository doesn't automatically remove them from using your storage allotment.
We can either delete all existing LFS objects in the repository, or you can let us know the object IDs of specific LFS files we should delete for you. (Or just the ones to save, if that's easier.) You can find the object IDs of all LFS objects from all branches, including previous versions of objects that are no longer being used, with this command:
git lfs ls-files --all --long
After providing us with the info about which objects to delete, you'll need to completely remove the deleted LFS files from the repository history, so that Git doesn't continue to track them in LFS. You can follow the steps in our guide:
Removing sensitive data from a repository
You can also uninstall LFS from the repository with
git lfs uninstall
. (For older versions of LFS, usegit lfs uninit
.)As you have consumed x GB of LFS bandwidth, LFS is still disabled for your account. It will reset when a new billing period starts in y days. If you need to get LFS working again before that you'll need to purchase a data pack. You might also be interested to know we're changing how LFS billing is handled and giving more storage and bandwidth for free in the near future! The exact date this is happening is still TBC, but you can keep an eye on that discussion post for updates.