(Windows 10)GitBash无法格式化颜色-找不到配置设置 [英] (Windows 10) GitBash not formatting colors - can't find configuration settings

查看:83
本文介绍了(Windows 10)GitBash无法格式化颜色-找不到配置设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景

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

My GitBash command line is not showing colors or formatting and seems to be escaping characters... e.g.

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

进行一些挖掘之后,我找到了以下解决方案:

After doing some digging I found this solution:

要显示转义字符,请尝试更改Git Bash右键单击终端">"xterm-256color"的终端选项选项>终端>类型> xterm-256color

For displaying escaped characters, please try changing Git Bash options for terminal to "xterm-256color" by Right Click on Terminal > Options > Terminal > Type > xterm-256color

问题

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

I honestly can't find this configuration setting at all... this is the closest I have come...

我如何实施上述解决方案?

How do I implement the solution above?

推荐答案

Windows CMD无法解释ANSI转义序列.

A Windows CMD does not interpret ANSI escape sequences.

您可以遵循" Windows外壳中的ANSI颜色"并下载ansicon ,并通过 ansicon -i 安装(与 ansicon -u ):适用于Windows 7.

You can follow "ANSI color in Windows shells" and download ansicon, install it with ansicon -i (uninstall with ansicon -u): that would be for Windows 7.

Windows 10确实支持ANSI颜色,但是请注意,在Windows 10的最新版本中,这可能无法正常工作,如在此问题中所见.

Windows 10 does have support for ANSI colors, but note that with recent version of Windows 10, that might not work, as seen in this issue.

问题在于,对于Windows 10.0.10586,默认情况下启用了该功能,但对于Windows 10.0.14393(周年更新),则必须由该程序显式启用它.

The problem is that for Windows 10.0.10586 it was enabled by default, but with Windows 10.0.14393 (Anniversary Update) it must be explicitly enabled by the program.

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

Try using your git commands in a CMD instead of a git bash.
By adding to your %PATH% the <path/to/git>\usr\bin folder, you will still be able to benefit from Linux commands without having to enter a git bash.

这篇关于(Windows 10)GitBash无法格式化颜色-找不到配置设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆