Petchav
Petchav

Reputation: 131

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.

Upvotes: 3

Views: 1961

Answers (2)

Petchav
Petchav

Reputation: 131

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

Upvotes: 5

bk2204
bk2204

Reputation: 76754

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.

Upvotes: 1

Related Questions