Defining environment variables for git LFS in netlify.toml

I have trouble getting web fonts set up for one of my websites. In netlify.toml I’ve defined:

environment = { GIT_LFS_ENABLED = “true” , GIT_LFS_FETCH_INCLUDE = "*.eot, *.woff, *.woff2 }

The deploy logs show now errors, config file and context are correct:

5:25:46 PM: ❯ Current directory
5:25:46 PM:   /opt/build/repo
5:25:46 PM: ​
5:25:46 PM: ❯ Config file
5:25:46 PM:   /opt/build/repo/netlify.toml
5:25:46 PM: ​
5:25:46 PM: ❯ Context
5:25:46 PM:   production

Doing the same configuration using the GUI, it works like a charm. Only the netlify.toml set up never works for me. Can anyone give me advice what I am doing wrong? Thanks.

Hi, @dafoobar. This environment variable is needed before the clone of the repo.

The netlify.toml file is only available after the repo cloning it done. At that point it it too late to set this environment variable. For this reason, it can only be set in the web UI.

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

Thank you Luke for the clarification. Makes sense. D’uh.

What is this then used for:

  VARIABLE = "value"

As seen here: File-based configuration | Netlify Docs

Does this only work for a sub set of variables, which are used after a clone? If yes, this should maybe be part of the documentation.

Those settings are indeed intended for “variables needed after clone, during build” which is when all other variables are useful and used. Those git related ones are the only ones in that exact situation of not being controllable via the toml file. Thanks for your suggestion - we’ll work with our documentation team on a way to make this more obvious in our docs! Could you point us in the right direction? Where would you have expected to find this mentioned? In the toml file doc you linked, or perhaps here? Build environment variables | Netlify Docs

It should be mentioned in both places.

In Build environment variables | Netlify Docs it should be mentioned that a subset of env vars can be defined in netlify.toml - linking to the toml documentation, where it should be mentioned clearly what is possible and what not.

Thanks for your help.

hey @dafoobar ! thanks for explaining - we definitely hope to get a docs update done when availability permits. :+1: