在 macOS 上使用 git-lfs pull 时出现 Gitkraken 错误

标签 git macos path git-lfs gitkraken

在 macOS 上使用 Gitkraken 进行 LFS pull 时出现错误。我收到以下错误消息:

Error on LFS Pull git: 'lfs' is not a git command. See 'git --help'. The most similar command is log


在 Gitkraken 文档( here )中,我们找到了以下解释:

Note: If GitKraken still cannot find Git or Git LFS, the terminal or CMD may be using a different path than the system or user path. For example, on OSX applications launched from the GUI have a different path than those launched from the terminal.


要检查这一点,我们可以执行以下命令:which git-lfswhich git事实上,我得到以下结果:
which git     /usr/bin/git \
which git-lfs /opt/homebrew/bin/git-lfs
然后,文档说您必须在路径中添加一个环境变量,示例是针对 Windows 给出的,但我无法为 macOS 重现等效项
在我的 .zshrc 中,我有这个:export PATH=$HOME/bin:/usr/local/bin:$PATH我试了一下:export PATH=$HOME/bin:/usr/local/bin:/opt/homebrew/bin/git-lfs:$PATH但它不起作用
错误可能非常明显,但我对环境变量等知之甚少。

最佳答案

我终于找到了解决我的问题的方法。
没有 PATH 问题,所以我在 .zshrc 中保留了原始行

export PATH=$HOME/bin:/usr/local/bin:$PATH
您必须使用终端转到项目并执行以下命令
git lfs install
答案将是

Updated git hooks.
Git LFS initialized.


然后做CMD + R在 Gitkraken 中。现在 LFS 图标将可见, pull 将起作用

关于在 macOS 上使用 git-lfs pull 时出现 Gitkraken 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66852435/

相关文章:

ios - iPad 作为使用蓝牙的 Mac 键盘

unix - 在Solaris的哪里设置LD_LIBRARY_PATH?

git - Sourcetree 远程 : Invalid username or password

git - 如何在 git svn create-ignore 之后获得一个 .gitignore

cocoa - 以编程方式检查进程是否正在 Mac 上运行

objective-c - 纯 C 语言的安全范围书签

Linux 找不到 metis.h

python - 如何从 pyCharm 向终端提供 'make directory as source root'

node.js - 调用 git Shortlog -sn 时, Node child_process spawn 挂起

javascript - 克隆后选择元素不起作用