Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 401
Petchav Avatar asked May 23 '26 09:05

Petchav


2 Answers

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

like image 88
Petchav Avatar answered May 25 '26 00:05

Petchav


Your PATH setting needs to refer only to directories, not to files. So if the git-lfs binary is in /opt/homebrew/bin, then you'd want to do this:

$ export PATH="$HOME/bin:/opt/homebrew/bin:$PATH"

Note that that may or may not have an effect on graphical programs, but should if the program is launched from the command line.

like image 44
bk2204 Avatar answered May 24 '26 22:05

bk2204