Search code examples
gitmacospathgit-lfsgitkraken

Gitkraken error when pull with git-lfs on macOS


I have an error during the LFS pull with Gitkraken on macOS. I get the following error message:

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

In the Gitkraken documentation (here) we find the following explanation:

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.

To check this, we can do the following command: which git-lfs and which git

Indeed, I get the following result:

which git     /usr/bin/git \
which git-lfs /opt/homebrew/bin/git-lfs

Then, the documentation says that you have to add an environment variable in the path, the example is given for windows, but I can't reproduce the equivalent for macOS

In my .zshrc I have this: export PATH=$HOME/bin:/usr/local/bin:$PATH

I tried it with: export PATH=$HOME/bin:/usr/local/bin:/opt/homebrew/bin/git-lfs:$PATH but it doesn't work

It's possible that the error is absolutely obvious but I don't know much about environment variables etc.


Solution

  • I finally found a solution to my problem.

    There was no PATH problem so I left the original line in .zshrc

    export PATH=$HOME/bin:/usr/local/bin:$PATH
    

    You have to go to the project with a terminal and do the following command

    git lfs install
    

    the answer will be

    Updated git hooks.
    Git LFS initialized.

    Then do CMD + R in Gitkraken. Now the LFS icon will be visible and the pull will work