Builds fail after new commit to git-lfs


I’ve switched my git repository (bitbucket) to use LFS for storing images. I’m not using Netlify large media. I’m noticing that whenever I add a new image to my repository, builds fail until I go into the netlify dashboard and trigger ‘Clear cache and deploy site’.

7:25:09 AM: Error checking out branch: Downloading static/uploads/2019/06/ONLIC.jpg (49 KB)
Error downloading object: static/uploads/2019/06/ONLIC.jpg (736daa2): Smudge error: Error downloading static/uploads/2019/06/ONLIC.jpg (736daa2d5e115ed1380da8f0828d38da06abbf27157fda54589b35468baea943): batch request: missing protocol: ""

Errors logged to /opt/build/repo/.git/lfs/logs/20190609T212509.938580537.log
Use `git lfs logs last` to view the log.
error: external filter 'git-lfs filter-process' failed
fatal: static/uploads/2019/06/ONLIC.jpg: smudge filter lfs failed
7:25:09 AM: Failing build: Failed to prepare repo
7:25:10 AM: failed during stage 'preparing repo': exit status 128
7:25:10 AM: Finished processing build request in 20.622859125s
7:25:10 AM: Shutting down logging, 0 messages pending

Once I do this, the (hugo) site builds straight away, and continues to rebuild when I make regular commits of markdown files.

Is there anything I can do to ensure the deploys don’t fail?

If cloning a repository using LFS, we recommend using an environment variable GIT_LFS_ENABLED in our documentation here. Quoting:

  • If you set a GIT_LFS_ENABLED variable, we’ll use git lfs clone to check out your repository — otherwise we just use git clone .

You can add the environment variable by going to Site Name > Settings > Build & deploy > Environment. Or by replacing <your-subdomain-here> with your Netlify subdomain in the URL below:<your-subdomain-here>/settings/deploys#environment

It is interesting that it appears to be attempting an LFS clone without this environment variable being used. I still suspect this missing variable may be the root cause.

Would you be willing to please test this?

​Please let us know if there are any questions and/or if this doesn’t resolve the issue.

1 Like

Thanks Luke. I’ve put the variable in my netlify.toml file, and will check it with the next site update.

1 Like