Skip to content

Echoing to stderr does not work in git hooks anymore #6053

@t-b

Description

@t-b

Existing issues matching what you're seeing

  • I was not able to find an open or closed issue matching what I'm seeing

Git for Windows version

git version 2.53.0.rc0.windows.1
cpu: x86_64
built from commit: 402505fde7dac415cd5437aa0e57b9b4d9efee4c
sizeof-long: 4
sizeof-size_t: 8
shell-path: D:/git-sdk-64-build-installers/usr/bin/sh
rust: disabled
feature: fsmonitor--daemon
libcurl: 8.18.0
OpenSSL: OpenSSL 3.5.4 30 Sep 2025
zlib: 1.3.1
SHA-1: SHA1_DC
SHA-256: SHA256_BLK
default-ref-format: files
default-hash: sha1

Windows version

Windows 11

Windows CPU architecture

x86_64 (64-bit)

Additional Windows version information

Microsoft Windows [Version 10.0.26200.7623]
(c) Microsoft Corporation. Alle Rechte vorbehalten.

Options set during installation

Editor Option: VIM
Custom Editor Path:
Default Branch Option: main
Path Option: CmdTools
SSH Option: OpenSSH
Tortoise Option: false
CURL Option: OpenSSL
CRLF Option: CRLFCommitAsIs
Bash Terminal Option: ConHost
Git Pull Behavior Option: Rebase
Use Credential Manager: Disabled
Performance Tweaks FSCache: Disabled
Enable Symlinks: Disabled
Enable FSMonitor: Disabled

Other interesting things

No response

Terminal/shell

Bash in Windows Terminal

Commands that trigger the issue

$ cat .git/hooks/pre-push
#!/bin/bash

set -e

echo "abcd" > /dev/stderr
git push

Expected behaviour

This worked with 2.52.0. From 1 my uneducated guess would be that

When calling Microsoft Store apps, their standard I/O is now git-for-windows/msys2-runtime#122 (meaning: You can call an interactive Python interpreter without the winpty hack mentioned in the release notes' Known Issues).

is related.

Doing echo "abcd" > /dev/stderr in the terminal directly works.

Actual behaviour

.git/hooks/pre-push: line 5: /dev/stderr: No such file or directory
error: failed to push some refs to 'XXX'

Repository

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions