pre-push hook 报告 git-lfs 不在我的路径中,但它是

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

我为 Windows 安装了 git-lfs。 Git BashPowerShell 似乎都在我的道路上。这是 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)

然而,当我 运行:

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

我在 pre-push 挂钩中得到以下内容。

#!/bin/sh
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 "$@"

我已经尝试删除 pre-push 挂钩并重新安装,但我仍然得到相同的结果。

我测试了推送一个应该被跟踪的文件...使用 git lfs track,添加了 .gitattributes 和被跟踪的文件,但它被推送到常规 git 存储库而不是git-lfs 存储。

知道为什么我无法 git lfs install 将正确的内容放入 pre-push 挂钩或知道任何解决方法吗?

"This repository is configured for Git LFS but 'git-lfs' was not found on your path." 对我来说是一条红鲱鱼。 pre-push脚本中有这个语句是正常的。

如果我 运行 command -v git-lfs || echo WTF 我得到 git-lfs 的路径。如果我将上面命令中的 git-lfs 替换为 git-lsf 之类的拼写错误,我会得到 WTF

我只是没有花足够的时间来理解 pre-push 脚本。

我的问题是我没有在我的 Gitlab 配置文件中启用 lfs 支持。