Skip to content

Windows: pre-push hook fails because hook proxy passes --to-stdin=/dev/stdin #22620

Closed

Description

@loganfinney27

The problem

When pushing from GitHub Desktop on Windows, a repository with a pre-push hook can fail before the hook body runs:

Running pre-push hook...
fatal: could not open '/dev/stdin' for reading: No such file or directory
pre-push hook failed with code 128

This appears to come from Desktop's hook proxy passing a Unix-style pseudo-path to git hook run:

https://github.com/desktop/desktop/blob/release-3.6.3/app/src/lib/hooks/hooks-proxy.ts#L180-L188

...(hasStdin ? ['--to-stdin=/dev/stdin'] : []),

git hook run --to-stdin=<path> expects a file path. On this Windows setup, both Git for Windows and GitHub Desktop's bundled Git fail when that path is /dev/stdin, before the repository hook itself can run.

Release version

GitHub Desktop 3.6.3

Operating system

Microsoft Windows 11 Pro 10.0.26200, build 26200

Steps to reproduce the behavior

  1. Use GitHub Desktop on Windows.
  2. Open a repository with core.hooksPath configured and a pre-push hook.
  3. Push from GitHub Desktop.
  4. Observe the pre-push failure above.

The repository hook involved in my case does not contain /dev/stdin. It is a normal tracked pre-push hook that eventually delegates to git lfs pre-push "$@".

Expected behavior

GitHub Desktop should pass hook stdin to git hook run using a Windows-compatible mechanism.

Since git hook run --to-stdin=<path> expects a file path, one possible implementation would be for Desktop to materialize the incoming hook stdin stream into a per-invocation temporary file and pass that real file path to --to-stdin, instead of passing /dev/stdin.

Actual behavior

Desktop passes --to-stdin=/dev/stdin. Git for Windows cannot open that path in this invocation path, so the hook fails before the hook script body runs.

Log files

Relevant excerpt from 2026-07-24.desktop.production.log:

2026-07-24T00:04:24.789Z - info: [ui] Executing push: git push origin logan/obsidian:logan/obsidian --progress (took 8.940s)
2026-07-24T00:04:24.793Z - error: [ui] `git push origin logan/obsidian:logan/obsidian --progress` exited with an unexpected code: 1.
Running pre-push hook...
fatal: could not open '/dev/stdin' for reading: No such file or directory
pre-push hook failed with code 128 after 0.23s
error: failed to push some refs to 'https://github.com/LAF-US/IDAHO-VAULT.git'

Additional diagnostics

Versions on the affected machine:

Git for Windows: git version 2.49.0.windows.1
GitHub Desktop bundled Git: git version 2.53.0.windows.3
Git LFS: git-lfs/3.6.1 (GitHub; windows amd64; go 1.23.3; git ea47a34b)

Direct reproduction with user Git for Windows:

git hook run --to-stdin=/dev/stdin pre-push -- origin https://github.com/OWNER/REPO.git

fails with:

fatal: could not open '/dev/stdin' for reading: No such file or directory

Using a real file path succeeds:

git hook run --to-stdin=.githooks/stub.txt pre-push -- origin https://github.com/OWNER/REPO.git

The same pass/fail behavior occurs with GitHub Desktop's bundled Git.

Inside Git Bash, /dev/stdin exists as a pseudo-path, but git hook run --to-stdin=/dev/stdin ... still fails after resolving to /proc/self/fd/0.

I also checked the current release-3.6.4-beta1 source, and it still appears to contain the same --to-stdin=/dev/stdin line:

https://github.com/desktop/desktop/blob/release-3.6.4-beta1/app/src/lib/hooks/hooks-proxy.ts#L180-L188

Provenance

This report is filed by Logan Finney, a GitHub Desktop user. The original failure was encountered manually while pushing from the GitHub Desktop GUI. I used an AI coding assistant, OpenAI Codex, to help inspect GitHub Desktop logs/source and run the local reproduction commands above; I cross-checked the findings before filing this issue.

Activity

  1. desktop-triage commented on Jul 28, 2026

    @desktop-triage

    Labeling this as bug + windows + priority-2: the issue clearly identifies that hooks-proxy.ts passes --to-stdin=/dev/stdin to git hook run, which fails on Windows because /dev/stdin is not a valid file path there — confirmed with a direct reproduction command and logs. No duplicate was found; the suggested fix (materializing stdin into a temp file on Windows) is a reasonable direction for engineering to evaluate.

    Generated by Issue Triage (skills-driven) for #22620 · sonnet46 20.2 AIC · ⌖ 5.17 AIC · ⊞ 5.7K · ◷

  2. added
    bug
    priority-2
    and removed on Jul 29, 2026
  3. Mustafa-shikalgar commented on Aug 1, 2026

    @Mustafa-shikalgar

    Hi! I'd like to work on this issue if it's available. I'll investigate the Windows hook proxy behavior and prepare a fix.

  4. 500gt commented on Oct 6, 2026

    @500gt
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

    bugpriority-2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions