windows - Windows 命令提示符中不显示 Git 颜色

标签 windows git bash command-line cmd

我假设这是因为我的配置文件中的颜色设置,但我尝试更改它无济于事。也许我做得不对?

请注意,Git Bash 将分支颜色显示为绿色,但在窗口 cl 上它根本没有显示!

enter image description here

$ git branch
* add_bower *<~~~ only the asterisk appears on the windows prompt.*
  master

最佳答案

cmd 中的 git 应该可以正常工作。在放弃之前,我会检查你的 gitconfig local 和 gitconfig global。

我要做的第一件事是

git branch --color

git diff --color

您还可以使用 -c option

git -c color.ui=always status

如果你看到颜色那么可能发生的是你的本地 gitconfig 覆盖了全局 gitconfig 中的设置

在那一点上做一个

git config --local --edit

如果显示为 auto 或 true 而您仍然看不到颜色。将输出设置为始终。我推荐这个 b\c git 可能会出错并且不将 cmd 视为终端

来自 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.

像这样

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

希望这对您有所帮助!

关于windows - Windows 命令提示符中不显示 Git 颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34241743/

相关文章:

git - 让 git 撤消任何仅空白的更改?

git - 如何在 git bash 终端(Windows 10)中打开谷歌浏览器

使用命令 `echo -ne "hello\n"` 的 Bash 与 Dash 行为

c++ - Windows GetDIBits 不返回预期值

c++ - 捕获隐藏桌面的屏幕截图

git - 如果本地存在分支,我应该在 pull 之前执行 git fetch 吗?

html - 在每个 unix GREP 结果周围添加 HTML 标签

windows - 需要帮助编写一个循环任务调度程序

windows - Windows 防病毒软件如何与文件访问过程 Hook ?

git - `go get` 首先失败,然后工作