- Find the location of the "git-lfs" executable, by running the command in a system terminal (i.e. not in MATLAB's Command Window):This will print the full path of the "git-lfs" executable (for example, /usr/local/bin/git-lfs).which git-lfs
- Open the file ~/.gitconfig, which is where Git stores its configuration.
- Replace any commands referring to "git-lfs" with its full path. For example, if "git-lfs" is at /usr/local/bin/git-lfs, the following line:would be replaced with:\ngit config --global filter.lfs.clean "git-lfs clean -- %f"git config --global filter.lfs.clean "/usr/local/bin/git-lfs clean -- %f"
How do I fix "git-lfs: command not found" on macOS?
56 views (last 30 days)
Show older comments
MathWorks Support Team
on 8 Jun 2023
Answered: MathWorks Support Team
on 16 Jun 2023
I want to use Git LFS to manage a Git repository which contains many large binary files. I have downloaded Git LFS on my macOS machine, and it works just fine when running Git from a command line. However, when I use Git within MATLAB, some operations fail with the error:
Error running filter git-lfs smudge -- <model name>.xlsx: /bin/sh: git-lfs: command not found
How do I resolve this error and using Git LFS from within MATLAB?
Accepted Answer
MathWorks Support Team
on 8 Jun 2023
When trying to run external executables, MATLAB will use the "PATH" environment variable (which is the Operating System's equivalent of MATLAB's internal 'path'). This error can occur if MATLAB is receiving a different value of PATH than command-line Git (one which does not contain the "git-lfs" executable).
Regardless of the values of the $PATH, the error can be resolved with the following steps:
This will make sure that, even when run from within MATLAB with a different $PATH value, Git will always load this exact file for "git-lfs".
0 Comments
More Answers (0)
See Also
Categories
Find more on Get Started with MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!