Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×I am primarily using GitLab and just started using LFS. When I commit+push LFS tracked files teammates who pull the commits down only get stubs for the files. Any ideas on what we are missing?
Hi Sean,
When your colleagues clone a repository with LFS content, two things are necessary to ensure the LFS pointers are replaced with the real objects.
Firstly, they must have LFS installed on their Git client. For the command line client this means running the "git-lfs install" command, which will add the following lines to the .gitconfig file in their home directory:
[filter "lfs"]
clean = git-lfs clean %f
smudge = git-lfs smudge %f
required = true
Next, the committer (you in this case) must have ensured that the .gitattributes file was checked in. This file is updated when you run the "git lfs track" (or untrack) commands. It will have lines like this:
*.jpg filter=lfs diff=lfs merge=lfs -text
*.tif filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
So, with those two things, when your colleagues clone or pull from the repository two things happen. Their Git client knows to run the "git-lfs" filter, and then the filter knows that for each of the file patterns in the .gitattributes file that it should fetch (if necessary) the real objects from LFS.
Hope this helps.
Regards,
Ben
Thanks. It must be the git lfs install that is missing.
I think I was under the impression that .gitconfig gets committed, but I'm seeing it does not.
I was also under the impression that SourceTree had git-lfs installed and didn't need the git lfs install command.
So does that need to be done for every repository or is it global?
Also, it would be awesome if the lfs filter in the gitattributes triggered some sort of warning to tell the user to run git lfs install. Odd thing is: I thought it did give an error about clean and smudge, but my colleague's client never complained.
Thanks again. I'll share this with him and hopefully it will rectify future issues.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.