git-lfsを使ってimageの管理ができた。 ハマったところはgit-lfsというよりnetlifyでgit-lfsをどうやって有効化するかということだった。

出力されていたエラーはこれ。

6:42:14 PM: Build ready to start
6:42:15 PM: build-image version: b0258b965567defc4a2d7e2f2dec2e00c8f73ad6
6:42:15 PM: build-image tag: v3.4.1
6:42:15 PM: buildbot version: 19f1164460e8d8241255cf2a71abc5e0e454118e
6:42:15 PM: Fetching cached dependencies
6:42:15 PM: Starting to download cache of 112.6MB
6:42:16 PM: Finished downloading cache in 702.546198ms
6:42:16 PM: Starting to extract cache
6:42:19 PM: Finished extracting cache in 2.507030232s
6:42:19 PM: Finished fetching cache in 3.233611984s
6:42:19 PM: Starting to prepare the repo for build
6:42:19 PM: Preparing Git Reference refs/heads/master
6:42:20 PM: Error checking out branch: Downloading hugo/static/img/xxx.png (72 KB)
Error downloading object: hugo/static/img/xxx.png (f7973bf): Smudge error: Error downloading hugo/static/img/xxx.png (f7973bf6d7ce4a2af3bbe1319e35701729cd6d8fb8eb5e39a57ffc8fcf06a0cf): batch request: missing protocol: ""

Errors logged to /opt/build/repo/.git/lfs/logs/20201031T094220.355850525.log
Use `git lfs logs last` to view the log.
error: external filter 'git-lfs filter-process' failed
fatal: hugo/static/img/xxx.png: smudge filter lfs failed
6:42:20 PM: Failing build: Failed to prepare repo
6:42:20 PM: Failed during stage 'preparing repo': exit status 128
6:42:20 PM: Finished processing build request in 4.766289019s

環境変数 GIT_LFS_ENABLEDtrue を設定するとgit-lfsが有効になった。

./img/screen-2020-10-31.56.52.png
Netlify環境変数の設定画面