Git had been previously working but today when I executed git status in any git directory, I got the following error:
sh: /Users/xxx/.zsh/bin/diff-highlight: No such file or directory
My $PATH is:
/Users/xxx/.composer/vendor/bin:/Documents/Ruby:/usr/texbin:/Users/xxx/.rbenv/shims:/Users/xxx/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin:/Library/TeX/texbin:/Users/xxx/.composer/vendor/bin:/Documents/Ruby:/usr/texbin:/Users/xxx/.rbenv/shims:/Users/xxx/.fzf/bin
Why am I getting this error?
Installing/updating to the latest Git version, mostly using proper package management tools like HOMEBREW, can usually solve problems related to installations and missing scripts/tools.
For some reason my system also did not find diff-highlight when issuing Git commands. While double checking it I figured out that I had diff-highlight set for my global Git as a pager, and whenever I tried to execute git sub-command (status/show/log) the non found pager wanted to come into play:
/ > git log
/usr/local/share/git-core/contrib/diff-highlight/diff-highlight | less -r: /usr/local/share/git-core/contrib/diff-highlight/diff-highlight: No such file or directory
After installing Git again via brew install git or brew update git, it got updated to the latest (2.13.x) version, as well as all the Git tools/files have been reset to its normal place. To obtain where the brew installation puts the scripts/tools and Git commands, files, you can issue:
/ > brew info git
git: stable 2.13.0 (bottled), HEAD
Distributed revision control system
https://git-scm.com
/usr/local/Cellar/git/2.13.0 (1,463 files, 33.2MB)
Under my ~/dotfiles folder where I store my global settings, amongst others also for Git, I updated the pager setting to the proper location of the diff-highlight in the ~/dotfiles/git/gitconfig file:
[core]
excludesfile = /Users/<user_name>/.gitignore_global
pager = /usr/local/Cellar/git/2.13.0/share/git-core/contrib/diff-highlight/diff-highlight | less -r
For the global settings I am using a customized version of Jack's Dotfiles.
I found the problem. In my .zsh directory, I had removed my subfolder /bin which had the diff-highlight executable. Putting the /bin back solved the problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With