#1518·lefthook

`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

yaml
# ...
    lefthook-validate:
      run: 'lefthook validate'
      use_stdin: false

Commands to reproduce

bash
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 lefthook process as an env var.
  • Provide a configuration flag, similar to min_version, to enforce a validation before run.
  • Override Lefthook and/or Git's behavior to not reset PATH or at least Lefthook's path. This seems to have a lot of intricacies and security implications, I suppose.