Repository navigation
Description
The problem
GitHub Desktop already implements hook-specific failure reporting, including identifying the failing hook and displaying its output. However, this functionality is only available when “Load Git hook environment variables from shell” is enabled.
With that preference disabled, Desktop bypasses the existing hook proxy and its failure reporting. A preference about where environment variables come from therefore also controls whether users receive hook-specific diagnostics.
I encountered this while pushing a repository with a pre-push hook. Desktop displayed:
The operation timed out because a response was not received from the virtual machine or container.
Error code: Bash/Service/HCS_E_CONNECTION_TIMEOUT
error: failed to push some refs
The failure occurred while launching the hook, but the dialog did not identify pre-push as its source.
Expected: reuse the existing hook-failure reporting regardless of the shell-loading preference. No additional diagnostic mechanism or UI should be necessary; the existing functionality needs to be available in both modes.
Release version
3.6.6
Operating system
Windows 11 Pro 25H2
Steps to reproduce the behavior
- In Options → Git → Hooks, leave “Load Git hook environment variables from shell” unchecked.
- In a disposable test repository with a configured remote, create a failing
pre-pushhook:#!/bin/sh echo "Example hook failure" >&2 exit 1
- Attempt to push using GitHub Desktop.
- Observe that the failure is reported through the generic push-error path rather than the existing hook-specific failure UI.
The simple hook above isolates the diagnostic gap from the Bash/WSL failure that originally exposed it.
Log files
No response
Screenshots
Additional context
The relevant functionality already exists. In withHooksEnv, the shell-loading preference currently causes an early return before the hook proxy is created. This skips both shell-environment loading and the existing hook progress/failure callbacks.
PR #21319 introduced these capabilities together. They share infrastructure, but hook-failure diagnostics are useful whether the environment is inherited or loaded from a shell.
The proposed change is to reuse the same proxy, callbacks, and UI in both modes, while limiting the preference to selecting the environment source:
- Enabled: load the shell environment as today.
- Disabled: use the inherited Git environment, preserving configuration and credentials while removing Desktop’s temporary interception settings.
In the original failure, the hook used #!/usr/bin/env bash. Investigation found that Desktop’s environment resolved Bash to the Windows WSL launcher, whereas system Git resolved Git for Windows’ Bash. That explains the execution difference; this issue specifically concerns the missing hook attribution.
Proposed implementation: PR #23011
Activity
desktop-triage commentedon Oct 13, 2026
Triage: Suggesting
bug+priority-3(for maintainer approval). The report describes a diagnostics regression, not a feature request: Desktop's existing hook-failure UI (identifying the failing hook and its output) is silently skipped whenever "Load Git hook environment variables from shell" is disabled, even though hooks still run. I found no exact duplicate; related issues (#22476 "post-merge hook does not appear to run in UI", #22620 "pre-push hook fails due to /dev/stdin", #22701 "pre-commit hook hanging") describe different gaps (missing diagnostics for specific hook types, a Windows stdin bug, and a hang), not this shell-preference gating.Initial hypothesis: In
with-hooks-env.tsat commit9ca714359368121907dbc638436d90c775717c91,withHooksEnvstarts withif (!opts?.interceptHooks || !getHooksEnvEnabled()) { return fn(opts?.env) }. This means that whenever the "load shell env" preference (getHooksEnvEnabled()) is off, the function returns early before the hooks proxy (createHooksProxy, lines 48–62) is ever constructed — the same proxy that wires upopts?.onHookProgressandopts?.onHookFailurecallbacks responsible for the hook-specific failure dialog. Git still executes hooks directly in that mode, but Desktop has no interception point to attribute a failure to a specific hook, so the error surfaces through the generic command-failure path instead (consistent with the reporter's screenshot showing a generic push error with nopre-pushattribution). This supports the reporter's proposed fix direction: decoupling proxy/callback creation from the shell-env-loading preference so hook-failure diagnostics work in both modes, while the preference only toggles the environment source used when hooks do run.Name failing hooks without loading the shell environment