Git colors don't display in Windows command prompt

后端 未结 3 919
离开以前
离开以前 2021-01-19 10:39

I assume that it\'s because of the color setting in my config file, but I\'ve tried changing that to no avail. Maybe I\'m not doing that right?

Notice that Git Bash

3条回答
  •  梦谈多话
    2021-01-19 10:56

    git in cmd should work just fine. I would check both your gitconfig local and gitconfig global before giving up here.

    the first thing I would do is a

    git branch --color
    

    or

    git diff --color
    

    you can also use the -c option

    git -c color.ui=always status
    

    if you see colors then what is likely happening is your local gitconfig is overriding the setting in your global gitconfig

    at that point do a

    git config --local --edit
    

    if things say auto or true and you still don't see colors. set the output to always. I recommend this b\c it is possible for git to make mistakes and not treat cmd as a terminal

    from git-config:

    If this is set to always, git-diff(1), git-log(1), and git-show(1) will use color for all patches. If it is set to true or auto, those commands will only use color when output is to the terminal. Defaults to false.

    like so

    [color]
        branch = always
        diff = always
        interactive = always
        status = always
        ui = always
    

    hope this helps!

提交回复
热议问题