Home
Support Forums

LFS not working as expected

bdsa.netlify.app

I’m trying to deploy a site that is hosted on GitLab. I cannot disable gitlab lfs, because of project needs. After deploying some files became corrupted: it’s content replaced with this text

version https://git-lfs.github.com/spec/v1
oid sha256:6bc32c13179d0e327ff209d1e270e9d8a5117...*
size 53248

Images, PDF’s deployed correctly.

Please, help with understanding a reason of such behavior.

LFS file that works: https://bdsa.by/docs/judges-list-2021.pdf
LFS file that doesn’t works: https://bdsa.by/docs/templates/membership-application-2021.doc

Deploy log shows no errors:
5:47:03 PM: Waiting for other deploys from your team to complete. Check the queue: https://app.netlify.com/teams/dsazonoff/builds
5:47:40 PM: Build ready to start
5:47:41 PM: build-image version: c6001ed68662a13e5deb24abec2b46058c58248a
5:47:41 PM: build-image tag: v3.9.0
5:47:41 PM: buildbot version: f650485c830eb31597911322420b99299a4303b8
5:47:42 PM: Building without cache
5:47:42 PM: Starting to prepare the repo for build
5:47:42 PM: No cached dependencies found. Cloning fresh repo
5:47:42 PM: git clone git@gitlab.com:bdsa/sportdance.by
5:47:47 PM: Preparing Git Reference refs/heads/master
5:47:48 PM: Parsing package.json dependencies
5:47:48 PM: Starting build script
5:47:49 PM: Installing dependencies
5:47:49 PM: Python version set to 2.7
5:47:50 PM: v12.18.0 is already installed.
5:47:50 PM: Now using node v12.18.0 (npm v6.14.4)
5:47:50 PM: Started restoring cached build plugins
5:47:50 PM: Finished restoring cached build plugins
5:47:51 PM: Attempting ruby version 2.7.2, read from environment
5:47:52 PM: Using ruby version 2.7.2
5:47:52 PM: Using PHP version 5.6
5:47:52 PM: Installing Hugo 0.74.3
5:47:53 PM: Hugo Static Site Generator v0.74.3-DA0437B4/extended linux/amd64 BuildDate: 2020-07-23T16:30:30Z
5:47:53 PM: Started restoring cached go cache
5:47:53 PM: Finished restoring cached go cache
5:47:53 PM: go version go1.14.4 linux/amd64
5:47:53 PM: go version go1.14.4 linux/amd64
5:47:53 PM: Installing missing commands
5:47:53 PM: Verify run directory
5:47:55 PM: ​
5:47:55 PM: ────────────────────────────────────────────────────────────────
5:47:55 PM:   Netlify Build                                                 
5:47:55 PM: ────────────────────────────────────────────────────────────────
5:47:55 PM: ​
5:47:55 PM: ❯ Version
5:47:55 PM:   @netlify/build 18.13.1
5:47:55 PM: ​
5:47:55 PM: ❯ Flags
5:47:55 PM:   baseRelDir: true
5:47:55 PM:   buildId: 614de4e72e9d5300f52e42b0
5:47:55 PM:   deployId: 614de4e72e9d5300f52e42b2
5:47:55 PM: ​
5:47:55 PM: ❯ Current directory
5:47:55 PM:   /opt/build/repo
5:47:55 PM: ​
5:47:55 PM: ❯ Config file
5:47:55 PM:   /opt/build/repo/netlify.toml
5:47:55 PM: ​
5:47:55 PM: ❯ Context
5:47:55 PM:   production
5:47:55 PM: ​
5:47:55 PM: ❯ Installing plugins
5:47:55 PM:    - netlify-plugin-minify-html@0.3.1
5:47:55 PM:    - netlify-plugin-image-optim@0.4.0
5:48:22 PM: ​
5:48:22 PM: ❯ Loading plugins
5:48:22 PM:    - netlify-plugin-minify-html@0.3.1 from Netlify app
5:48:22 PM:    - netlify-plugin-image-optim@0.4.0 from Netlify app
5:48:23 PM: ​
5:48:23 PM: ────────────────────────────────────────────────────────────────
5:48:23 PM:   1. build.command from netlify.toml                            
5:48:23 PM: ────────────────────────────────────────────────────────────────
5:48:23 PM: ​
5:48:23 PM: $ hugo
5:48:24 PM: Building sites …
5:48:24 PM:                    | RU
5:48:24 PM: -------------------+-----
5:48:24 PM:   Pages            | 44
5:48:24 PM:   Paginator pages  |  0
5:48:24 PM:   Non-page files   |  0
5:48:24 PM:   Static files     | 93
5:48:24 PM:   Processed images |  0
5:48:24 PM:   Aliases          | 10
5:48:24 PM:   Sitemaps         |  1
5:48:24 PM:   Cleaned          |  0
5:48:24 PM: Total in 487 ms
5:48:24 PM: ​
5:48:24 PM: (build.command completed in 549ms)
5:48:24 PM: ​
5:48:24 PM: ────────────────────────────────────────────────────────────────
5:48:24 PM:   2. onPostBuild command from netlify-plugin-minify-html        
5:48:24 PM: ────────────────────────────────────────────────────────────────
5:48:24 PM: ​
5:48:24 PM: Minifiying HTML in the deploy context: production
5:48:24 PM: Minifiying HTML with these options: Default
5:48:24 PM: ​
5:48:24 PM: (netlify-plugin-minify-html onPostBuild completed in 333ms)
5:48:24 PM: ​
5:48:24 PM: ────────────────────────────────────────────────────────────────
5:48:24 PM:   3. onPostBuild command from netlify-plugin-image-optim        
5:48:24 PM: ────────────────────────────────────────────────────────────────
5:48:24 PM: ​
5:48:44 PM: │ File                                                                │ Before    │ After     │ Reduction │
5:48:44 PM: ├─────────────────────────────────────────────────────────────────────┼───────────┼───────────┼───────────┤
5:48:44 PM: │ /favicon-32x32.png                                                  │ 550 B     │ 415 B     │ 135 B     │
5:48:44 PM: │ /favicon.png                                                        │ 18.58 KB  │ 4.39 KB   │ 14.19 KB  │
5:48:44 PM: │ /favicon.svg                                                        │ 5.01 KB   │ 3.74 KB   │ 1.28 KB   │
5:48:44 PM: │ /images/code.jpg                                                    │ 200.79 KB │ 189.16 KB │ 11.63 KB  │
5:48:44 PM: │ /images/code.png                                                    │ 348.01 KB │ 122.75 KB │ 225.26 KB │
5:48:44 PM: │ /images/code@2x.jpg                                                 │ 564.5 KB  │ 525.29 KB │ 39.21 KB  │
5:48:44 PM: │ /images/code@2x.png                                                 │ 1.28 MB   │ 339.16 KB │ 969.91 KB │
5:48:44 PM: │ /images/main.jpg                                                    │ 219.98 KB │ 219.98 KB │ 0 B       │
5:48:44 PM: │ /fonts/fontawesome5/fa-brands-400.svg                               │ 713.19 KB │ 451.24 KB │ 261.95 KB │
5:48:44 PM: │ /fonts/fontawesome5/fa-regular-400.svg                              │ 141.32 KB │ 101.67 KB │ 39.65 KB  │
5:48:44 PM: │ /fonts/fontawesome5/fa-solid-900.svg                                │ 892.7 KB  │ 643.66 KB │ 249.04 KB │
5:48:44 PM: │ /images/author/default.jpg                                          │ 30.84 KB  │ 30.84 KB  │ 0 B       │
5:48:44 PM: │ /images/author/joseph-gonzalez-399972-unsplash.jpg                  │ 27.32 KB  │ 27.32 KB  │ 0 B       │
5:48:44 PM: │ /images/author/rawpixel-330235-unsplash.jpg                         │ 45.26 KB  │ 45.26 KB  │ 0 B       │
5:48:44 PM: │ /images/logo/logo-invert-mobile.svg                                 │ 5.01 KB   │ 3.74 KB   │ 1.28 KB   │
5:48:44 PM: │ /images/logo/logo-invert.svg                                        │ 5.01 KB   │ 3.74 KB   │ 1.28 KB   │
5:48:44 PM: │ /images/logo/logo-mobile.svg                                        │ 5.01 KB   │ 3.74 KB   │ 1.28 KB   │
5:48:44 PM: │ /images/logo/logo.svg                                               │ 5.01 KB   │ 3.74 KB   │ 1.28 KB   │
5:48:44 PM: │ /images/pages/bantersnaps-5U_28ojjgms-unsplash-2000.jpg             │ 344.79 KB │ 344.79 KB │ 0 B       │
5:48:44 PM: │ /images/pages/bantersnaps-5U_28ojjgms-unsplash-800.jpg              │ 71.34 KB  │ 71.34 KB  │ 0 B       │
5:48:44 PM: │ /images/pages/freddy-do-hgbyl2H0zRU-unsplash-2000.jpg               │ 413.21 KB │ 413.21 KB │ 0 B       │
5:48:44 PM: │ /images/pages/freddy-do-hgbyl2H0zRU-unsplash-800.jpg                │ 90.96 KB  │ 90.96 KB  │ 0 B       │
5:48:45 PM: Creating deploy upload records
5:48:44 PM: │ /images/pages/jean-philippe-delberghe-75xPHEQBmvA-unsplash-3000.jpg │ 454.18 KB │ 454.18 KB │ 0 B       │
5:48:44 PM: │ /images/pages/lance-anderson-GOK4iscFSkA-unsplash-2000.jpg          │ 257.33 KB │ 244.33 KB │ 13 KB     │
5:48:44 PM: │ /images/pages/nastuh-abootalebi-yWwob8kwOCk-unsplash-2000.jpg       │ 347.33 KB │ 347.33 KB │ 0 B       │
5:48:44 PM: │ /images/pages/nastuh-abootalebi-yWwob8kwOCk-unsplash-800.jpg        │ 74.22 KB  │ 74.22 KB  │ 0 B       │
5:48:44 PM: │ /images/pages/photo-1593055454503-531d165c2ed8-1170.jpg             │ 145.16 KB │ 145.16 KB │ 0 B       │
5:48:44 PM: │ /images/pages/photo-1596128446017-1106bd96ef89-1170.jpg             │ 55.23 KB  │ 55.18 KB  │ 52 B      │
5:48:44 PM: │ /images/pages/wonderlane-FkHpejze0C4-unsplash-2000.jpg              │ 398.5 KB  │ 398.5 KB  │ 0 B       │
5:48:44 PM: │ /images/pages/wonderlane-FkHpejze0C4-unsplash-800.jpg               │ 86.88 KB  │ 86.88 KB  │ 0 B       │
5:48:44 PM: │ /images/partners/default.svg                                        │ 2.85 KB   │ 2.63 KB   │ 223 B     │
5:48:44 PM: │ /images/partners/forestry.svg                                       │ 2.85 KB   │ 2.63 KB   │ 223 B     │
5:48:44 PM: │ /images/partners/github.svg                                         │ 5.98 KB   │ 2.56 KB   │ 3.43 KB   │
5:48:44 PM: │ /images/partners/hugo.svg                                           │ 110.59 KB │ 110.42 KB │ 182 B     │
5:48:44 PM: │ /images/partners/markdown.svg                                       │ 311 B     │ 272 B     │ 39 B      │
5:48:44 PM: │ /images/partners/netlify.svg                                        │ 5.82 KB   │ 5.38 KB   │ 449 B     │
5:48:44 PM: │ /images/partners/netlifycms.svg                                     │ 6.97 KB   │ 6.76 KB   │ 219 B     │
5:48:44 PM: │ /images/posts/default-2000.jpg                                      │ 214.56 KB │ 214.56 KB │ 0 B       │
5:48:44 PM: │ /images/posts/default-800.jpg                                       │ 36.44 KB  │ 36.44 KB  │ 0 B       │
5:48:44 PM: │ /images/posts/hannah-grace-j9JoYpaJH3A-unsplash-2000.jpg            │ 1.17 MB   │ 1.17 MB   │ 0 B       │
5:48:44 PM: │ /images/posts/hannah-grace-j9JoYpaJH3A-unsplash-800.jpg             │ 121.13 KB │ 121.13 KB │ 0 B       │
5:48:44 PM: │ /images/posts/harley-davidson-BW9ki_tmouE-unsplash-2000.jpg         │ 392.11 KB │ 392.11 KB │ 0 B       │
5:48:44 PM: │ /images/posts/harley-davidson-BW9ki_tmouE-unsplash-800.jpg          │ 101.33 KB │ 101.33 KB │ 0 B       │
5:48:44 PM: │ /images/posts/hello-i-m-nik-UyjW_oWBQiE-unsplash-2000.jpg           │ 214.56 KB │ 214.56 KB │ 0 B       │
5:48:44 PM: │ /images/posts/hello-i-m-nik-UyjW_oWBQiE-unsplash-800.jpg            │ 36.44 KB  │ 36.44 KB  │ 0 B       │
5:48:44 PM: │ /images/posts/jean-philippe-delberghe-zMoHzV59tSc-unsplash-2000.jpg │ 695.01 KB │ 695.01 KB │ 0 B       │
5:48:44 PM: │ /images/posts/jean-philippe-delberghe-zMoHzV59tSc-unsplash-800.jpg  │ 159.05 KB │ 159.05 KB │ 0 B       │
5:48:44 PM: │ /images/posts/mike-von-aaWaG-raMNw-unsplash-2000.jpg                │ 607.08 KB │ 607.08 KB │ 0 B       │
5:48:44 PM: │ /images/posts/mike-von-aaWaG-raMNw-unsplash-800.jpg                 │ 138.8 KB  │ 138.8 KB  │ 0 B       │
5:48:44 PM: │ /images/posts/pexels-josh-hild-4606770.jpg                          │ 116.18 KB │ 112.44 KB │ 3.74 KB   │
5:48:44 PM: ┌─────────────────────────────────────┐
5:48:44 PM: │   Images optimized - 1.8 MB saved   │
5:48:44 PM: └─────────────────────────────────────┘
5:48:44 PM: ​
5:48:44 PM: (netlify-plugin-image-optim onPostBuild completed in 20.3s)
5:48:44 PM: ​
5:48:44 PM: ────────────────────────────────────────────────────────────────
5:48:44 PM:   4. Deploy site                                                
5:48:44 PM: ────────────────────────────────────────────────────────────────
5:48:44 PM: ​
5:48:44 PM: Starting to deploy site from 'public'
5:48:44 PM: Creating deploy tree 
5:48:45 PM: 0 new files to upload
5:48:45 PM: 0 new functions to upload
5:48:45 PM: Site deploy was successfully initiated
5:48:45 PM: ​
5:48:45 PM: (Deploy site completed in 188ms)
5:48:45 PM: Starting post processing
5:48:45 PM: ​
5:48:45 PM: ────────────────────────────────────────────────────────────────
5:48:45 PM:   Netlify Build Complete                                        
5:48:45 PM: ────────────────────────────────────────────────────────────────
5:48:45 PM: ​
5:48:45 PM: (Netlify Build completed in 50s)
5:48:45 PM: Post processing - HTML
5:48:45 PM: Caching artifacts
5:48:45 PM: Started saving build plugins
5:48:45 PM: Finished saving build plugins
5:48:45 PM: Started saving pip cache
5:48:45 PM: Finished saving pip cache
5:48:45 PM: Started saving emacs cask dependencies
5:48:45 PM: Finished saving emacs cask dependencies
5:48:45 PM: Started saving maven dependencies
5:48:45 PM: Finished saving maven dependencies
5:48:45 PM: Started saving boot dependencies
5:48:45 PM: Post processing - header rules
5:48:45 PM: Finished saving boot dependencies
5:48:45 PM: Started saving rust rustup cache
5:48:45 PM: Finished saving rust rustup cache
5:48:45 PM: Started saving go dependencies
5:48:45 PM: Finished saving go dependencies
5:48:45 PM: Post processing - redirect rules
5:48:45 PM: Post processing done
5:48:45 PM: Site is live ✨
5:48:48 PM: Build script success
5:49:05 PM: Finished processing build request in 1m23.243109943s

Hi, @Dmitry. You will need to use the environment variable GIT_LFS_ENABLED=true to resolve this. That environment variable tells Netlify that your repo is using Git LFS and will cause the build system to clone the actual files and not just the pointer files (those three line text files are Git LFS pointer filers).

Note, you must add that example.com in the web UI at Netlify and not in netlify.toml. That is because we need that environment variable set before cloning and netlify.toml isn’t read until after the clone is complete.

You can find the environment variable settings under Site Name > Settings > Build & deploy > Environment.

There is more information at the end of the documentation section linked to below:

https://docs.netlify.com/configure-builds/environment-variables/#netlify-configuration-variables

​Please let us know if that does not fix the issue or if there are any other questions.

Unfortunately it doesn’t help. Here is a log:

2:52:37 AM: Build ready to start
2:52:38 AM: build-image version: c6001ed68662a13e5deb24abec2b46058c58248a
2:52:38 AM: build-image tag: v3.9.0
2:52:38 AM: buildbot version: f650485c830eb31597911322420b99299a4303b8
2:52:38 AM: Building without cache
2:52:38 AM: Starting to prepare the repo for build
2:52:38 AM: Git LFS enabled
2:52:38 AM: Configured environment variable GIT_LFS_ENABLED=true conflicts with Netlify Large Media.
2:52:38 AM: If you are moving from another LFS service, make sure to migrate all LFS files to Netlify, then remove GIT_LFS_ENABLED variable from your Netlify Build & deploy settings.
2:52:38 AM: Creating deploy upload records
2:52:38 AM: Failing build: Failed to prepare repo
2:52:39 AM: Failed during stage 'preparing repo': Conflict LFS setup
2:52:39 AM: Finished processing build request in 276.824964ms

I don’t see any options, how to configure Large Media in netlify settings (web ui).

Seems that I should ask you for a manual disabling Large Media support for my website (bdsa.netlify.app).

Hi, @Dmitry. You can use Git LFS with or without Large Media. When I checked your site on 2021-09-25, Large Media was not added to the site at that time. So, at the time I wrote my reply, the instructions I gave were correct for Git LFS without Large Media.

You has since installed the Large Media add-on for this site so my instructions no longer apply. It might help to explain more about what Large Media is.

Large Media is a replacement for the default Git LFS service provided by the repo’s Git host (Bitbucket, GitLab, GitHub). You can use Git LFS without Large Media or with Large Media. Using Git LFS without Large Media means using the Git LFS service at your Git host. Using it with Large Media means moving the Git LFS portion of the Git hosting to Netlify.

Using Git LFS without Large Media doesn’t change anything at Netlify except that the environment variable to download the actually media files are required (GIT_LFS_ENABLED=true).

There are changes if you use Large Media. If you do, you can no longer access the real media during the build which will prevent any build time image transformations from woking. (Note, that is a Large Media limitation but not a limitation if using Git LFS without Large Media). On the other hand, once Large Media is used browse time image transformations become possible which doesn’t work without it.

So, it is up to you if you want to troubleshoot using Large Media or just uninstall it and use plain Git LFS.

Before we proceed with an uninstall, would you please confirm you have read the following Support Guide?

If you have read that, please confirm you have backups of all files and that we should proceed with removing the Large Media add-on.

Now, if you instead want to troubleshoot the Large Media installation, please let us know. The support guide below has initial troubleshooting steps if you want to keep Large Media:

Just let us know which option you choose and we will follow-up with next steps based on what you opt for.

1 Like

Yes, I would like to remove Large Media add-on. I did all backups. Thanks for your help.

Hi,

We have removed the Large Media add-on from the site now.

Would you please push the commit removing .lfsconfig to the upstream repository? This will trigger a new build.

Please keep in mind that you might want to run the command below after deleting the .lfsconfig file:

git lfs push --all origin

This will sync the local repo’s LFS objects with the Git LFS service at the original Git host. It pushes any new binary blobs to their LFS service which may have been added after you moved the LFS service to Large Media.

Please let us know if there are any issues with the new build or deployed site.

Unfortunately it doesn’t solved the original issue. Files are still without it content. GIT_LFS_ENABLED is true in the web UI.

Hi, @Dmitry. I do see many Microsoft office files in the most recent deploy which are still Git LFS pointers. Same with /favicon.ico, it is the pointer and not the image. All the other media files are working.

The solution for this would be to use the GIT_LFS_FETCH_INCLUDE environment variable to tell the build image what other Git LFS files to download the actual file data for instead of the pointer. By default the following is used:

	fetchinclude = *.jpg,*.png,*.jpeg,*.svg,*.gif,*.pdf,*.mp4,*.bmp,*.webp

As you can see, .ico and MS office files are not in that list. If you want to clone the actual data for the icon file and the Microsoft office files, you would need an environment variable like so:

GIT_LFS_FETCH_INCLUDE='*.jpg,*.png,*.jpeg,*.svg,*.gif,*.pdf,*.mp4,*.bmp,*.webp,*.ico,*.xls,*.doc'

Note, that is just an example. The full environment variable will need to contain all file extensions you are using with Git LFS.

1 Like

Thanks a lot for your help, now everything works.

1 Like