It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to pull LFS files (GitLab)

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?

1 answer

0 votes

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.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Off-topic

Do you still play the same games you played when you were a kid?

Months ago, I was walking in a huge grocery store and I went to the toys aisle and found a jigsaw puzzle that was more than 50% off, and I thought "why not? It will be fun and it can be a beautiful f...

315 views 35 12
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you