Configuring Netlify to serve files from Git-LFS [1] can lead to frustration [2] as solutions are not easily findable.

Set environment variables

Setting the correct environment variables in Netlify, fixes the obscure downloadable font: rejected by sanitizer error. The files exist on the host and can be downloaded but can not be referenced in e.g. .css files.

Configuration in web interface

In your Netlify account [3], go to Build & deployEnvironment and click on Edit variables to adjust the settings that control the environment your site builds in and/or gets deployed to. Set the following two environment variables and values:

GIT_LFS_FETCH_INCLUDE = *.eot, *.woff, *.woff2

Configuration in netlify.toml

In addition to using the Netlify web interface to configure environment variables, you can also configure some settings in a netlify.toml file stored in the root of your site repository.

Unfortunately, GIT environment variables are needed before cloning the repository. Thus, GIT_LFS variables are not controllable via the netlify.toml file.[5]

The following code example does not work:

  GIT_LFS_ENABLED = "true"
  GIT_LFS_FETCH_INCLUDE = "*.eot, *.woff, *.woff2"


Large File Storage


  1. Git Large File Storage (LFS) website
  2. Netlify issue 175: LFS support for font files
  3. Netlify application
  4. Netlify file-based configuration
  5. Defining environment variables for Git LFS in netlify.toml not possible