Colourless Git Output

I teach git and often have issues with bad projectors where you can’t see the colours. Recently I had a setup where even white on black was more or less invisible, but using black text on a white background worked okay. There’s lots of documentation on how to turn on colours in git but not so much about how to turn them off.

Try putting the following into .git/config:

[color]
    branch = false
    diff = false
    interactive = false
    status = false

I had expected to be able to set color.ui to false but that didn’t seem to make much difference, so I now use the settings above. I thought I’d drop it here in case anyone else is looking for the same thing.

3 thoughts on “Colourless Git Output

  1. From the man page under “color.ui” (version 1.7.10.4):
    “This variable determines the default value for variables such as
    color.diff and color.grep that control the use of color per command
    family. Its scope will expand as more commands learn configuration
    to set a default for the –color option. Set it to always if you
    want all output not intended for machine consumption to use color,
    to true or auto if you want such output to use color when written
    to the terminal, or to false or never if you prefer git commands
    not to use color unless enabled explicitly with some other
    configuration or the –color option.”

    So, setting it to false should do the trick, but maybe you have something that overrides it somewhere?

    • Yeah I think you are right and there is something strange about my setting, that’s one reason why I shared what I actually had to do when the solution from the docs didn’t work for me. I’ll update if I find out what my strange config is!

    • For the record, I had the same experience as Lornajane. Thanks for the helpful blog post! I came here via Google after also failing to get “color.ui” to do what it was supposed to do. I had expected setting color.ui to work based on reading the same text in the man page, but it simply doesn’t.

      On the other hand, setting each of the four color.* parameters individually does work. I have almost nothing else in my global gitconfig (and the system gitconfig is empty) so I find it unlikely that I’ve inadvertently added a config that shadows this; I rather suspect a bug in git, which may have gone undiscovered (and remains unfixed even today) because turning off color seems to be an uncommon request.

Leave a Reply

Please use [code] and [/code] around any source code you wish to share.

This site uses Akismet to reduce spam. Learn how your comment data is processed.