Skip to content

/usr/local/bin not in PATH for git hooks #14319

Closed

Description

@gilbitron

The problem

I have a pre-commit git hook with a Docker command like:

docker compose exec -T -u ...

When trying to commit files in GitHub Desktop I get an error from the hook "docker: command not found". Committing files from the command line works fine. On further investigation, it looks like /usr/local/bin is missing from my PATH when git hooks run from GitHub Desktop. Any ideas how to resolve this?

Release version

2.9.12 (arm64)

Operating system

macOS

Steps to reproduce the behavior

No response

Log files

No response

Screenshots

No response

Additional context

No response

Pinned by niik

Activity

  1. younkim commented on Sep 14, 2022

    @younkim

    @gilbitron Did you have any luck resolving this?

  2. gilbitron commented on Sep 14, 2022

    @gilbitron
    Author

    @younkim I just brute-forced it:

    PATH=/usr/local/bin:$PATH && docker compose exec -T -u ...
    
  3. sumitramanga commented on May 24, 2023

    @sumitramanga

    Bump on this to get fixed on Github's end. It would be much more ideal to automate adding the env variable to PATH upon installation of GH Desktop if that's possible :)

  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