Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to pull LFS files (GitLab)

Naphier February 9, 2016

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
Ben Humphreys
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 9, 2016

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

 

Naphier February 9, 2016

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
TAGS
AUG Leaders

Atlassian Community Events