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:
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.
I encountered the same “smudge filter lfs failed” error when I added LFS images to my Bitbucket git repository. Setting GIT_LFS_ENABLED to true fixed the problem for me.
However I didn’t set it in netlify.toml, I set it on the Netlify website at Settings > Build & deploy > Environment > Environment variables. I suspect setting it in netlify.toml couldn’t work because wouldn’t that file only be read after the image has been checked out of git without LFS enabled?
Thanks @gtch. Now you mention it, all the documentation I read mentioned setting GIT_LFS_ENABLED true in the netlify control panel rather than in netlify.toml. I couldn’t understand why that was the case, but your post makes perfect sense! Thanks.