Daniel Daniel - 11 months ago 126
Git Question

pre-push hook is reporting that git-lfs is not in my path, but it is

I have git-lfs installed for Windows. It seems to be in my path for both

Git Bash
. Here is the output from
Git Bash

502618458@G13G3Q72E MINGW64 ~
$ which git-lfs
/c/Program Files/Git LFS/git-lfs

502618458@G13G3Q72E MINGW64 ~
$ git lfs version
git-lfs/1.4.4 (GitHub; windows amd64; go 1.7.3; git cbf91a9)

Yet, when I run:

$ git lfs install
Updated pre-push hook.
Git LFS initialized.

I get the following in the

command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/pre-push.\n"; exit 2; }
git lfs pre-push "$@"

I've tried deleting the
hook and reinstalling and I still get the same result.

I tested pushing a file that should be tracked... Used
git lfs track
, added
and the tracked file, but it gets push into the regular git repo instead of git-lfs storage.

Any idea why I can't get
git lfs install
to put the right contents into the
hook or know of any workarounds?

Answer Source

The "This repository is configured for Git LFS but 'git-lfs' was not found on your path." was a red herring for me. It's normal to have this statement in the pre-push script.

If I run command -v git-lfs || echo WTF I get the path to git-lfs. If I replace git-lfs in the above command with a typo like git-lsf I get WTF

I just didn't take enough time to understand the pre-push script.

My problem was that I had not enabled lfs support in my Gitlab configuration file.