Murmele / Gittyup

Understand your Git history!
https://murmele.github.io/Gittyup
MIT License
1.43k stars 107 forks source link

git-lfs not found on MacOS #502

Open AssembIer opened 1 year ago

AssembIer commented 1 year ago

I just wanted to drag this over from the GitAhead repo, I am facing the exact same issue the user here described:

https://github.com/gitahead/gitahead/issues/127#issuecomment-892755331

While the git binary itself is in the system bin folder /usr/bin the git-lfs binary is not present and needs to be installed. It will usually end up in /usr/local/bin after installation, as we are unable to install it in the system bin folder or add symlinks to it.

On terminal this is not an issue, because the installation script of git-lfs adds the location to the Path var (if it is not present already), so git can see it. However when executing git within Gittyup this var is not present and git-lfs can not be found.

One way to solve this would be adding a path prefix in the settings where users can set a custom path to the git binary. This way we could point to /usr/local/bin and then create a symlink there for git, so both are being executed in the same location.

Or is there any another way to do this (maybe through the Gittyup config file) ??

exactly-one-kas commented 1 year ago

git-lfs should be found if it is in $PATH. Is /usr/local/bin in the user- or system-wide PATH environment variable or just in .bash_profile or the terminal app?

AssembIer commented 1 year ago

It is present in the user PATH var and it should be in the system wide too, at least cat /private/etc/paths includes the path /usr/local/bin (not sure how to verify this though).

I've tried to set it explicitly in the /etc/paths.d/ and /private/etc/paths.d folder by creating a new file with the path inside there. I also modified the .bashrc and .zshrc files to export the path, but obviously that does not help.

Murmele commented 1 year ago

https://github.com/Murmele/Gittyup/blob/889727ca686920cc31d36fffbc1ba813f7600433/src/git/Repository.cpp#L1196-L1222

MarcelInTO commented 4 months ago

I am still seeing this in version v1.3.0 on macos. No problem from git command line. In Gittyup I see:

    [-] Unable to push to 'origin' - failed to execute pre-push hook: 
         This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting '.git/hooks/pre-push'.
 Git LFS was not found on the PATH. Install Git LFS to use LFS integration.

In shell:

% whereis git-lfs git-lfs: /opt/homebrew/bin/git-lfs /opt/homebrew/share/man/man1/git-lfs.1

% printenv | grep PATH PATH=/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/WVS/Utilities/wvs-go-cli:/Applications/WVS/Utilities/PortableGit/git/bin:/Applications/WVS/Utilities/PortableGit/git/libexec/git-core

Pedro-Beirao commented 3 months ago

GUI Mac apps cannot access global environment variables (really sucks yeah) instead, they have their own environment variables that are mostly useless

some apps work arround this by running a daemon that copies the global env vars into the app's env vars