在 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-lfs
和 which 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/