`lefthook` not found when called with `push` hook command
Author: sanmai-NLCreated Aug 31, 2026Updated Aug 31, 2026
Labelsbug
Description
When invoked from another hook (using uv run lefthook run ...), the following lefthook-validate command works fine. But when running git push, PATH appears to be reset (perhaps by Git itself).
lefthook.yml
# ...
lefthook-validate:
run: 'lefthook validate'
use_stdin: falseCommands to reproduce
export LEFTHOOK_VERBOSE=true...
┃ lefthook-validate ❯
sh: lefthook: command not found
...Lefthook version
2.1.10 8d9cfec5f52367af6374a5430b4e9568844856e5
Possible solutions
Alternatives:
- Provide the path to the currently running
lefthookprocess as an env var. - Provide a configuration flag, similar to
min_version, to enforce a validation beforerun. - Override Lefthook and/or Git's behavior to not reset
PATHor at least Lefthook's path. This seems to have a lot of intricacies and security implications, I suppose.
Source: evilmartians/lefthook