Skip to content

Git hooks support #21501

Closed
Closed

Description

@niik

Experimental hooks support is currently released to beta. This issue is tracking the work needed to ship hooks support to production.


Background

GitHub Desktop has long struggled with Git hooks. Because Desktop ships with its own embedded Git installation (especially on Windows), hooks often fail when they depend on the user's shell environment, version managers, or tools not present in Desktop's stripped-down Git. Additionally, Desktop previously had no way to distinguish between a hook rejection and other Git failures, and terminal escape codes in hook output would render as garbled text.

This work introduces optional hook interception that addresses these issues by running hooks in the user's configured shell environment.

What's in beta

  • Shell environment execution: Hooks run in the user's configured shell (zsh, bash, Git Bash,
    PowerShell), inheriting environment variables from login scripts
  • Hook bypass support: Users can preemptively skip commit hooks or bypass a failed hook after the fact
    without aborting
  • Live hook output: Desktop shows hook output in real-time as it runs
  • Terminal rendering: Integrated xterm.js to properly render colors and escape codes

Requirements

Nice to have but not required for prod ship

  • Telemetry
  • Progress reporting during merge (in case pre-merge-commit takes a long time)

Activity

  1. added
    triage
    on Jan 22, 2026
  2. removed
    triage
    on Jan 22, 2026
  3. changed the title [-]Hooks tracking issue[/-] [+]Git hooks support[/+] on Jan 22, 2026
  4. sindhu838 commented on Mar 9, 2026

    @sindhu838

    Thanks for the detailed explanation.

    I have a couple of questions:
    • How does Desktop detect the user's default shell across different operating systems?
    • What happens if the configured shell fails to execute the hook?
    • Are there any fall backs to the embedded Git environment?

  5. niik commented on Mar 9, 2026

    @niik
    MemberAuthor

    • How does Desktop detect the user's default shell across different operating systems?

    Short answer is it doesn't, for macOS it'll use the SHELL environment variable falling back to /bin/bash, for Windows it'll default to Git Bash if Git for Windows is installed.

    • What happens if the configured shell fails to execute the hook?

    GitHub Desktop will pop a dialog showing the output and exit code from the hook and the user gets to decide whether to ignore the hook error or abort the commit.

    • Are there any fall backs to the embedded Git environment?

    In so far that the user can decide to not load environment variables from their shell, yes. This is still the default for production.

  6. niik commented on Mar 9, 2026

    @niik
    MemberAuthor

    Gonna close this issue as it shipped in 3.5.5!

  7. sindhu838 commented on Mar 9, 2026

    @sindhu838
  8. sindhu838 commented on Mar 11, 2026

    @sindhu838
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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