New Solution

The original solution is from 2016. Tech progresses...

Seems the best solution now is

git lfs migrate

Thanks to @iff_or for alerting me to this (see comments).

Outdated Solution, don't use

I then discovered a few fixes, some of which seem to be bugs, some of which simply were not obvious to me.

  1. It seems that in order to use lfs with an existing repository, a hack or third party tool such as BFG's converter is needed.

    • I did not want to go that route, so I simply initialized a new repository locally, then did the challenge of hooking it back up to the real repo.
    • I created a new directory, then git init, etc.
      • In my case, the remote repository was GitHub. So I did all those proper hookups like git remote add origin [email protected]:<my_id>/<my_repo>.git
  2. Also, while Git's Training Video claims that you can simply specify a folder, such as "my_folder/", I could not get this to work. Therefore, I just cleverly used filename extensions to manage things.

    • For example, git lfs track "my_folder/" would not work for me, but git lfs track "*.zip" did work.
  3. I had no luck getting LFS files to be identified correctly unless I had first updated the .gitattributes file, and committed and pushed that new file to the remote server.

    • git lfs track "*.zip"
    • git add .gitattributes
    • git commit -m "Updated the attributes"
    • git push
    • git add my_large_file.zip
    • git lfs ls-files
      • And here I would ensure that I saw my_large_file.zip being tracked.
    • git commit -m "Now I am adding the large file"
    • git push

It's possible that some of the things work, and I was simply doing them wrong. However, following the witchcraft described above finally got LFS to work, so I thought I'd pass on these details for others, in case someone else had the same problem.

Answer from Mike Williamson on Stack Overflow
🌐
Git LFS
git-lfs.com
Git Large File Storage | Git Large File Storage (LFS) replaces large files such as audio samples, videos, datasets, and graphics with text pointers inside Git, while storing the file contents on a remote server like GitHub.com or GitHub Enterprise.
Note that defining the file types Git LFS should track will not, by itself, convert any pre-existing files to Git LFS, such as files on other branches or in your prior commit history.
🌐
GitHub
docs.github.com › en › repositories › working-with-files › managing-large-files › configuring-git-large-file-storage
Configuring Git Large File Storage - GitHub Docs
To associate a file type in your repository with Git LFS, enter git lfs track followed by the name of the file extension you want to automatically upload to Git LFS.
Discussions

github - Git LFS refused to track my large files properly, until I did the following - Stack Overflow
Problem I had troubles trying to use git LFS, despite the many suggestions here on SO, on Git and GitHub's documentation, and on some Gists I'd run across. My problem was as follows: After perfo... More on stackoverflow.com
🌐 stackoverflow.com
Git lfs with files in repo that are already committed
I have a repo that has a folder of files that should be managed under git-lfs. I've done git lfs track for each of the files, it created the .gitattributes file. But when I did a git status, it onl... More on github.com
🌐 github.com
19
November 30, 2015
Unable to track a large file (103mb) without extension using Git LFS.
I'm not super familiar with Git LFS, but it looks like github doesn't like the file. Do you have to instantiate the remote repo specifically on git-lfs.github.com like it says in the message? More on reddit.com
🌐 r/git
5
9
October 29, 2020
git lfs - How to add a single file to GIT LFS? - Stack Overflow
How can I add just a single file to GIT LFS? Most examples show adding a pattern that specifies which files to add to LFS. However, I wish to add single file. If, for example, I do git lfs track &q... More on stackoverflow.com
🌐 stackoverflow.com
🌐
Josh-Ops
josh-ops.com › posts › add-files-to-git-lfs
Adding Files to Git LFS | josh-ops
January 27, 2026 - You can always run git lfs uninstall to unconfigure. Once you track the file(s) you want to add to LFS with the git lfs track command, you simply have to stage with git add, commit, and push as normal.
🌐
Debian Manpages
manpages.debian.org › testing › git-lfs › git-lfs-track.1.en.html
git-lfs-track(1) — git-lfs — Debian testing — Debian Manpages
November 25, 2025 - Start tracking the given patterns(s) through Git LFS. The argument is written to .gitattributes.
🌐
Readthedocs-hosted
jcsda-jedi-docs.readthedocs-hosted.com › en › latest › inside › developer_tools › gitlfs.html
Git-LFS — JEDI Documentation 8.0.0 documentation
When you pull or fetch and checkout a particular commit, then git LFS will check to see if you already have the tracked files on your system. This is called your local LFS cache. If so, it will replace the pointers with your local files.
🌐
Medium
dr-lucasleibs.medium.com › tracking-large-files-in-github-git-lfs-4b13d05dc2a3
Tracking Large Files in GitHub: Git LFS | by Lucas Leiberman | Medium
March 7, 2021 - After searching google and trying a handful of different approaches I was stuck. I finally came across a solution the next day. I hope this post will find any future programmers and save them the headache I endured trying to fix this. We will be using Git LFS(Large File Storage) to track our large files.
Find elsewhere
Top answer
1 of 6
43

New Solution

The original solution is from 2016. Tech progresses...

Seems the best solution now is

git lfs migrate

Thanks to @iff_or for alerting me to this (see comments).

Outdated Solution, don't use

I then discovered a few fixes, some of which seem to be bugs, some of which simply were not obvious to me.

  1. It seems that in order to use lfs with an existing repository, a hack or third party tool such as BFG's converter is needed.

    • I did not want to go that route, so I simply initialized a new repository locally, then did the challenge of hooking it back up to the real repo.
    • I created a new directory, then git init, etc.
      • In my case, the remote repository was GitHub. So I did all those proper hookups like git remote add origin [email protected]:<my_id>/<my_repo>.git
  2. Also, while Git's Training Video claims that you can simply specify a folder, such as "my_folder/", I could not get this to work. Therefore, I just cleverly used filename extensions to manage things.

    • For example, git lfs track "my_folder/" would not work for me, but git lfs track "*.zip" did work.
  3. I had no luck getting LFS files to be identified correctly unless I had first updated the .gitattributes file, and committed and pushed that new file to the remote server.

    • git lfs track "*.zip"
    • git add .gitattributes
    • git commit -m "Updated the attributes"
    • git push
    • git add my_large_file.zip
    • git lfs ls-files
      • And here I would ensure that I saw my_large_file.zip being tracked.
    • git commit -m "Now I am adding the large file"
    • git push

It's possible that some of the things work, and I was simply doing them wrong. However, following the witchcraft described above finally got LFS to work, so I thought I'd pass on these details for others, in case someone else had the same problem.

2 of 6
32

To put files on an existing repo on lfs you can also do:

git lfs migrate import --include="*.mp3,*.pth"

(Replace .mp3 and .pth with the file extension you wish to put on lfs)

🌐
Anchorpoint
anchorpoint.app › blog › push-and-pull-files-with-git-lfs
Push and pull files with Git LFS
February 12, 2026 - git lfs migrate import --include="*.psd" --everything · Replace "*.psd" with the patterns of the files you've tracked.
🌐
DevTut
devtut.github.io › git › git-large-file-storage-lfs.html
Git - Git Large File Storage (LFS)
A common workflow for using Git LFS is to declare which files are intercepted through a rules-based system, just like .gitignore files. Much of time, wildcards are used to pick certain file-types to blanket track.
🌐
GitHub
github.com › git-lfs › git-lfs › discussions › 5313
Determine if files are managed by git-lfs · git-lfs/git-lfs · Discussion #5313
To confirm if a file is tracked by Git LFS, you can use the git lfs ls-files command. This command should output a list of all files that are currently tracked by Git LFS.
Author   git-lfs
🌐
GitHub
github.com › git-lfs › git-lfs › issues › 874
Git lfs with files in repo that are already committed · Issue #874 · git-lfs/git-lfs
November 30, 2015 - I have a repo that has a folder of files that should be managed under git-lfs. I've done git lfs track for each of the files, it created the .gitattributes file. But when I did a git status, it onl...
Author   git-lfs
🌐
Perforce Software
perforce.com › blog › vcs › how-git-lfs-works
Git LFS (Git Large File Storage) Overview | Perforce Software
February 20, 2023 - It takes extra steps to maintain Git Large File Storage because you have to set it up for every Git repo, i.e. every Git project. That means for every repo, you have to install Git LFS, tell LFS to track a file type, then add the tracking information to the repo so that when you commit a file of that type, it will be placed in an LFS repository.
🌐
Reddit
reddit.com › r/git › unable to track a large file (103mb) without extension using git lfs.
r/git on Reddit: Unable to track a large file (103mb) without extension using Git LFS.
October 29, 2020 -

I'm trying to get Git LFS to track a large file. Since the large file has no extension, I tried to track the folder. But somehow I'm unable to track the folder where this file is in. I fucked everything up before, so this is what I've got going on now.

  • I temporarily deleted the 103 MB file from my project.

  • I deleted all the .gitattributes track commands from the file.

  • My local and remote repositories are equal right now, branch is up to date.

Everytime I add the file back to the folder, track the folder and try to push I get this same error: https://i.imgur.com/Uo41z7Z.png

MyTargetSDK.framework is the folder the big file is in. I tried these lines to track the folder:

git lfs track 'Horror Game/Assets/Plugins/iOS/Yodo1Ads/thirdsdk/Yodo1MyTarget/MyTargetSDK.framework'

git lfs track 'D:\Unity\EvilKid\Horror Game\Assets\Plugins\iOS\Yodo1Ads\thirdsdk\Yodo1MyTarget\MyTargetSDK.framework'

git lfs track 'D:/Unity/EvilKid/Horror Game/Assets/Plugins/iOS/Yodo1Ads/thirdsdk/Yodo1MyTarget/MyTargetSDK.framework'

git lfs track 'Yodo1Ads/**'

I'm hoping someone could tell me how I can succesfully track the folder where this huge file is in and push everything to my remote repos.

Fixed the problem thanks to u/pi3832v2 I used this line to track my file: git lfs track --filename "MyTargetSDK"

🌐
DEV Community
dev.to › mishmanners › how-to-use-git-lfs-to-store-big-files-on-github-2b2e
How to use Git LFS to store big files on GitHub - DEV Community
Once you've installed Git LFS, ... is located on your local machine. Navigate to that folder: ... Next, use the track command, to add the large file....
Published   February 22, 2024
🌐
Deploycode
deploycode.dev › article › How_to_use_Git_LFS_for_managing_large_files.html
How to use Git LFS for managing large files
Instead of storing the entire file in the Git repository, Git LFS stores a pointer to the file and the actual file content in a separate storage system. This means that your Git repository remains lightweight and fast, while still allowing you to version and track your large files.
🌐
Diginode
diginode.in › home › what is git ? › installing and configuring git lfs
Installing and Configuring Git LFS - Diginode
December 21, 2024 - Git Large File Storage (Git LFS) is a powerful extension for Git that allows efficient tracking of large files. Instead of storing entire file versions in the Git repository, Git LFS stores only references (pointers) to large files, which are ...
🌐
Canarys
ecanarys.com › home › using git lfs to manage large file storage
Using Git LFS to Manage Large File Storage - Canarys
January 17, 2023 - Step-2: After you download and install Git LFS, you can start managing large files in a Git repository by running git lfs track , where is a command-line glob specifying a particular file, extension, directory, or any combination.