Gitlab LFS hanging builds


I’m trying to push a change to my site, but it’s hanging on the build. I added lfs hosted on Gitlab in this change, so I suspect that the issue is related to that.

My builds stop at:
12:14:37 AM: Preparing Git Reference merge-requests/88/head

Is there an issue with using Gitlab LFS to host files? I don’t need any of the Netlify LFS features, and I need these files across 3 Netlify sites, so I’d like to stick with Gitlab LFS.

Is it possible to use Gitlab LFS with Netlify sites?



Hi, @qoouep, and thank you for joining our Netlify community site.

If you are using Git LFS (but not Netlify Large Media) an environment variable can be used to the our build system to do a git lfs clone for the repo.

That environment variable is GIT_LFS_ENABLED and setting that to true .

This can be set at “Site Name” > Settings > Build & deploy > Environment in our web app or in the netlify.toml configuration file for the site.

Would you please confirm that environment variable is used or test it if it is not? If it is set and there are still issues, please reply anytime. We’ll be happy to troubleshoot further. :+1:

I was able to get it to work! I have a bit of feedback though.

  1. It’s pretty bad UX for builds to hang instead of surfacing errors. Are there error messages that get swallowed here? Could the site use better messaging here?
  2. Initially I thought it wasn’t working. I was putting my entire assets folder in lfs, and my favicons weren’t loading. It turns out that for some reason specifically the .ico files were not getting pulled in, and were loading as pointer data when I went to /favicon.ico. I was able to fix this for myself by excluding the .ico files from LFS, but this is kind of strange to me. Why was this happening? Will it miss other files?

Hi, @qoouep, I’d like to research this further before filing a new issue (as I think it may match an existing issue). Would you please send us a link to the deploy with the error above (and you can just send the deploy id from the end of the URL if you prefer)?

This will tell me if there is a swallowed error we could surface.

Regarding question two about the .ico file, this isn’t one of the file type which is clone in binary format. The defaults as listed here:

To get the git lfs clone to include that file extention, an additional environment variable is required, that being GIT_LFS_SMUDGE_FILTER. If you want to include .ico files in addition to the current defaults, this should be set like so (in the Netlify UI only as it won’t work in the repo itself):


We do have an open issue to update our documentation to better cover third-party Git LFS configurations like these.

Again, a link to the deploy will help confirm the next steps for question one above.

Here are a couple:

Is there a reason why the files can’t be detected automatically with git lfs ls-files or something?

Hi, @qoouep, I did confirm there is no error message being suppressed. I filed a feature request here to not filter the Git LFS tracked files when GIT_LFS_SMUDGE=1 is used:

If there are other questions about this, please let us know.