How to Untrack Git LFS Files in Your Github Repo

Опубликовано: 26 Февраль 2025
на канале: Max O'Didily
766
13

How to Untrack Git LFS Files in Your Github Repo

Greetings, in this Github tutorial we shall be looking at how to untrack file types that are currently being tracked by Git LFS. It is really simple to stop tracking a file using Git LFS (Large File Storage), so let's get right into it.

To get Git LFS to untrack a file type, you need to do a few commands in Git Bash.

Here is a link to download Git bash: https://git-scm.com/downloads

Here is a list of every command used in this tutorial:

git lfs ls-files
git lfs untrack "*.mp4"
git add .gitattributes
git commit -m "Stop tracking .mp4 files with LFS"
git push origin

Firstly we can use: git lfs ls-files This will print to the Git bash console all files in our repo that are currently being tracked by Git LFS. Then we can do git lfs untrack "*.mp4" to tell our Git LFS to stop tracking mp4 files. We can replace the file type with whatever file type you no longer want Git LFS to track.

Then we need to add the changes we made to the gitattributes file as that stores the rules for what out Git LFS tracks. Then we just need to comit the changes and push them up to the repo.

You will need to do this for all branches in your GitHub repository. Also, telling Git LFS to not track a file type will not result in files being stored in your Git LFS storage to be deleted.

Deleting files stored on Git LFS is hard, but here is a stack overflow thread to explain how to do it: https://stackoverflow.com/questions/3...

Thanks for watching this Github tutorial on how to use git lfs untrack.

If this tutorial on how to change file in Git from Git LFS to a normal Git file useful, then be sure to subscribe.

Thanks for watching this Github tutorial on how to stop tracking git lfs files.

How to Untrack Git LFS Files in Your Github Repo