Skip to content

GitHubDesktop 3.4.9 Hook Script System Variable Issue Remains Unsolved  #19652

Closed

Description

@zhihaolai

The problem

When attempting to commit using this version, I encountered the error: .git/hooks/pre-commit: line 29: python: command not found.
I am certain that my python environment is properly configured. After printing the $PATH, I found that the path format was non-Windows, with some parts like:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Users/ts/AppData/Local/GitHubDesktop/app-3.4.9/resources/app/git/mingw64/libexec/git-core:/mnt/c/

I browsed related issues on Github (such as local hooks stopped working after updating to latest verison. #18739 and Use dugite system config #563) and tried the proposed solutions, but the problem remains unresolved.

Ultimately, I was able to solve the issue by disabling the Windows Subsystem for Linux.

However, I sometimes need to use the Windows Subsystem for Linux, so I hope a better solution can be found that allows me to use both GitHubDesktop and the subsystem without encountering this problem.

Release version

Version 3.4.9 (x64)

Operating system

Windows11

Steps to reproduce the behavior

No response

Log files

echo $PATH when error:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Users/ts/AppData/Local/GitHubDesktop/app-3.4.9/resources/app/git/mingw64/libexec/git-core:/mnt/c/Users/ts/AppData/Local/GitHubDesktop/app-3.4.9/resources/app/git/mingw64/bin:/mnt/c/Users/ts/AppData/Local/GitHubDesktop/app-3.4.9/resources/app/git/usr/bin:/mnt/c/Users/ts/bin:/mnt/c/Users/ts/AppData/Local/GitHubDesktop/app-3.4.9/resources/app/git/mingw64/bin:/mnt/c/Users/ts/AppData/Local/GitHubDesktop/app-3.4.9/resources/app/git/mingw64/usr/bin:/mnt/c/Program Files/YunShu/utils:/mnt/c/Program Files/Common Files/Oracle/Java/javapath:/mnt/d/Program Files/ImageMagick-7.1.1-Q16-HDRI:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/Microsoft SQL Server/150/Tools/Binn/:/mnt/d/Program Files/CMake/bin:/mnt/d/Program Files/7-Zip:/mnt/c/Users/ts/AppData/Local/Programs/Python/Python38:/mnt/c/Program Files/dotnet/:/mnt/g/platform-tools:/mnt/d/Program Files/gnuplot/bin:/mnt/d/Program Files/:/mnt/d/Program Files/TortoiseGit/bin:/mnt/c/Program Files (x86)/NetSarang/Xftp 7/:/mnt/d/Program Files/Git/cmd:/mnt/c/Program Files (x86)/Windows Kits/10/Windows Performance Toolkit/:/mnt/c/Users/ts/AppData/Local/Microsoft/WindowsApps:/mnt/d/Users/ts/AppData/Local/Programs/Microsoft VS Code/bin:/mnt/c/Users/ts/AppData/Local/Programs/Python/Python38/Scripts:/mnt/g/Fever System/fastboot:/mnt/d/Program Files/JetBrains/PyCharm Community Edition 2023.2/bin:/mnt/f/StudyProjet/LumixEngine/projects:/mnt/c/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/Llvm/x64/bin11:/mnt/d/Program Files/git-filter-repo:/mnt/c/Users/ts/.dotnet/tools:/mnt/c/Users/ts/AppData/Local/GitHubDesktop/bin
Python 执行失败,错误信息:
.git/hooks/pre-commit: line 29: python: command not found

Screenshots

No response

Additional context

No response

Pinned by niik

Activity

  1. added
    triage
    on Dec 3, 2024
  2. added
    investigation-needed
    and removed
    triage
    on Dec 16, 2024
  3. 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

    investigation-needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions