Skip to content

Lefthook Git hook returning executable file not found in %PATH% #13052

Closed

Description

@bbodenmiller

Describe the bug

Lefthook Git hook returning executable file not found in %PATH% when run from GitHub Desktop however does not throw error when run from Git bash

Version & OS

Version 2.9.3

Windows 1809

Steps to reproduce the behavior

  1. Install Lefthook to PATH & run lefthook install
  2. Add lefthook.yml to repo folder as follows
    pre-commit:
      commands:
        fix-line-endings:
          glob: "*.{config}"
          run: unix2dos {staged_files}
    
  3. Add web.config file to repo folder
  4. Attempt to commit

Expected behavior

pre-commit hook should run just as it does in Git Bash

Actual behavior

pre-commit hook does not run as it does in Git Bash

Screenshots

image

image

Pinned by niik

Activity

  1. bbodenmiller commented on Oct 1, 2021

    @bbodenmiller
    Author

    Hooks in GitHub desktop don't have access to $PATH? 🤔

        path:
          glob: "*.{config}"
          run: echo $PATH
        path2:
          glob: "*.{config}"
          run: echo %PATH%
    

    Results in:

    image

  2. Envek commented on Oct 1, 2021

    @Envek

    Lefthook maintainer is also here. Yep, there is a problem with $PATH population for hooks when commit is being made from within GitHub Desktop and other GUI tools on various OSes. See also evilmartians/lefthook#178 (comment) for more details.

  3. stacksjb commented on Jun 6, 2025

    @stacksjb

    I'm still running into this issue 4 years lter? I spent HOURS going crazy wondering why the hook isn't working when pushing from Github Destkop.

  4. niik commented on Jan 14, 2026

    @niik
    Member

    Yesterday we shipped GitHub Desktop 3.5.5-beta1 to our beta channel with improved support for hooks related to committing.

    Screenshot showing the GitHub Desktop commit form as a pre-commit hook is running

    The support is experimental and currently limited to our beta channel. While we believe that this release resolved this issue we're looking for real-world feedback so if you have the ability we'd appreciate it if you could download our beta channel and give it a spin. Ensure the experimental hooks support it's enabled by going to Settings -> Git -> Hooks and making sure the "Load Git hook environment variables from shell" is ticked.

    Screenshot showing the hook settings dialog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions