3

My current git push output is as follows:

enter image description here

The error message is hardly visible. The above is despite the following setting:

[color "interactive"]
  error = red bold

What should be the setting for error messages?

Old Geezer
  • 14,854
  • 31
  • 111
  • 198

2 Answers2

2

That seems to be a remote sideband output, which means you need:

  • Git 2.19+
  • git config color.remote.error "red bold"
  • git config color.remote always

That would color what the remote is producing.

But in your case, if the error message is not produced by the remote, then the color would be managed by color.interactive.<slot>:

git config color.interactive.error "red bold"

(and an error "failed to push to remote..." is likely to be produced by your local Git instance, not by a remote sideband output)

Or, as the OP comments: color.push.error:

git config color.push.error "red bold"

In both cases, this is a local color setting, not a remote one.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Doesn't seem to work. I set `color.remote.error`, `hint` and `warning` to "red bold" but `git push` still comes out dull red. – Old Geezer Mar 07 '19 at 04:53
  • @OldGeezer What version of Git are you using? – VonC Mar 07 '19 at 08:13
  • git version 2.21.0.windows.1 – Old Geezer Mar 08 '19 at 03:40
  • @OldGeezer Can you try with `color.remote always` and `color.remote.error "red bold"`, as in https://github.com/git/git/commit/bf1a11f0a100b080a25233980c14b5ae8f3a7d2d#diff-5baff4b2e097c317e9945480560bcdd0R68? – VonC Mar 08 '19 at 07:39
  • @OldGeezer In other words, setting the color alone is not enough, setting `color.remote=always` might be required. – VonC Mar 08 '19 at 07:43
  • Alas, still no joy. My config file now contains [color]\n ui=auto\n remote=always\n[color "remote"]\n error = red bold – Old Geezer Mar 10 '19 at 16:23
  • @OldGeezer Strange (https://github.com/git/git/blob/1f672904508c9c4e722efaf6bb8696b2e7b9d8e0/t/t5409-colorize-remote-messages.sh#L33-L40) Unless the color you see is already bold red... Can you try with any other color, just for testing? – VonC Mar 10 '19 at 18:10
  • I changed all the remote colors to cyan just to test, but it remains dull red. So it looks like it is taking colors from somewhere else. I reproduce my config file contents in the question. I am not sure if there are any syntax errors in there. I also assume there is no need to "reboot" git after making config changes, ie they should take effect on the next use of a git command. – Old Geezer Mar 11 '19 at 13:12
  • @OldGeezer I confirm: no need to reboot. – VonC Mar 11 '19 at 13:25
  • @OldGeezer All I can think of is that the error is not one produced by remote, but by the local Git. That color would *not* be managed by `color.remote.error` – VonC Mar 11 '19 at 13:26
  • @OldGeezer Try instead https://git-scm.com/docs/git-config#Documentation/git-config.txt-colorinteractiveltslotgt: `color.interactive.error`. I have updated my answer. – VonC Mar 11 '19 at 13:28
  • I found the answer: `color.push.error` Thanks for your help and guiding me to it. – Old Geezer Mar 11 '19 at 15:00
  • @OldGeezer Great! i have updated the answer accordingly. – VonC Mar 11 '19 at 15:17
0
git config color.push.error "red bold"
Old Geezer
  • 14,854
  • 31
  • 111
  • 198