threads / discuss / 64379

color.ui is not working as expected

Subject: color.ui is not working as expected

## tl;dr

One message between Oct 24, 2025 and Oct 24, 2025.

replies: 0people: 1as markdown or json

John Bevan· Oct 24, 2025, 13:37 UTC · lore
Hi,

There seems to be an issue with colour formatting on output from git; e.g. error messages are showing in the console's default colour instead of red, despite colour.ui being set to always.

I'm using the Windows version of git, but on submitting this issue there I was directed to yourselves. https://github.com/git-for-windows/git/issues/5907#issuecomment-3433888979

It seems that the issue is down to errors being sent to the error function in usage.c (https://github.com/git/git/blob/master/usage.c#L291), but that function doesn't include colour based formatting.

Thanks in advance,
JB

(Apologies for not following the advice at: http://www.chiark.greenend.org.uk/~sgtatham/bugs.html - sadly my company blocks access to HTTP (without TLS) sites, and this site doesn't present via HTTPS).

Additional Info
Git for Windows version
git version 2.51.1.windows.1
cpu: x86_64
built from commit: 1454f0a9c4a3a22fb3fd7cc33f76f88cd65ced41
sizeof-long: 4
sizeof-size_t: 8
shell-path: D:/git-sdk-64-build-installers/usr/bin/sh
feature: fsmonitor--daemon
libcurl: 8.16.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.22631.6060] Options set during installation Editor Option: VIM Custom Editor Path: Default Branch Option: Path Option: Cmd SSH Option: OpenSSH Tortoise Option: false CURL Option: OpenSSL CRLF Option: CRLFAlways Bash Terminal Option: MinTTY Git Pull Behavior Option: Merge Use Credential Manager: Enabled Performance Tweaks FSCache: Enabled Enable Symlinks: Disabled Enable FSMonitor: Disabled

Other interesting things ANSI colour codes proven to work by running "e[31mREDe[0m" in pwsh/powershell.

git config --global --list gives: core.sshcommand='C:\Windows\System32\OpenSSH\ssh.exe' core.autocrlf=false core.longpaths=true core.editor=code -w -n core.pager=less -FRX user.name=REDACTED user.email=REDACTED user.signingkey=~/.ssh/id_ecdsa.pub safe.directory=* gpg.format=ssh gpg.ssh.allowedsignersfile=~/.ssh/allowed_signers commit.gpgsign=true filter.lfs.clean=git-lfs clean -- %f filter.lfs.smudge=git-lfs smudge -- %f filter.lfs.process=git-lfs filter-process filter.lfs.required=true diff.tool=vscode difftool.vscode.cmd=code -w -n --diff $LOCAL $REMOTE merge.tool=vscode mergetool.vscode.cmd=code -w -n --merge $REMOTE $LOCAL $BASE $MERGED init.defaultbranch=main color.ui=auto color.error=red bold

Git.exe is at: %appdatalocal%\Programs\Git\cmd\git.exe
.gitconfig is at: %UserProfile\.gitconfig

Terminal/shell PowerShell

Commands that trigger the issue git checkout nonExistantBranch

Expected behaviour Output error: pathspec 'nonExistantBranch' did not match any file(s) known to git in red

Actual behaviour Output error: pathspec 'nonExistantBranch' did not match any file(s) known to git in white (terminal default)

← back to recent threads