【问题标题】:(Windows 10) GitBash not formatting colors - can't find configuration settings(Windows 10)GitBash 没有格式化颜色 - 找不到配置设置
【发布时间】:2017-05-29 21:40:24
【问题描述】:

背景

我的 GitBash 命令行未显示颜色或格式,并且似乎正在转义字符...例如

The Entity shortcut name: CarBundle:Car
C[K7arBundle8a[K7rBundle8r[K7Bundle8B[K7undle8u[K7ndle8n[K7dle8d[K7le8l[K7e8e[K:[KC[Ka[Kr[K

经过一番挖掘,我找到了这个解决方案:

为了显示转义字符,请尝试更改 Git Bash 通过右键单击终端>将终端选项设置为“xterm-256color” 选项 > 终端 > 类型 > xterm-256color

问题

老实说,我根本找不到这个配置设置......这是我最接近的......

如何实现上述解决方案?

【问题讨论】:

    标签: git command-line cmd git-bash


    【解决方案1】:

    Windows CMD 不解释 ANSI 转义序列。

    您可以关注“ANSI color in Windows shells”和download ansicon,使用ansicon -i 安装(使用ansicon -u 卸载):适用于Windows 7。

    Windows 10 does have support for ANSI colors,但请注意,对于最新版本的 Windows 10,这可能无法正常工作,如 this issue 所示。

    问题在于,对于 Windows 10.0.10586,它默认启用,但对于 Windows 10.0.14393(周年更新),它必须由程序显式启用。

    尝试在 CMD 中使用 git 命令,而不是 git bash
    通过将<path/to/git>\usr\bin 文件夹添加到您的%PATH%,您仍然可以从Linux 命令中受益,而无需输入git bash。

    【讨论】:

      【解决方案2】:

      对于遇到相同问题并找到此线程的任何人:

      This solution 在 Windows 10 上为我工作:

      在另一个线程中得到帮助 - 创建了一个 windows 系统变量 FORCE_COLOR 并将其设置为 true,没有重新启动,现在我在 Git Bash (windows 7) 中有颜色

      【讨论】:

        猜你喜欢
        • 2019-09-03
        • 1970-01-01
        • 2011-02-11
        • 2015-12-19
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-07-30
        • 1970-01-01
        相关资源
        最近更新 更多