(Windows 10) GitBash not formatting colors - can't find configuration settings

ⅰ亾dé卋堺 提交于 2021-02-19 05:31:38

问题


Background

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:

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

Question

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

How do I implement the solution above?


回答1:


A Windows CMD does not interpret ANSI escape sequences.

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 does have support for ANSI colors, but note that with recent version of Windows 10, that might not work, as seen in this issue.

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.

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.




回答2:


For anyone having the same problem and finding this thread:

This solution worked for me on Windows 10:

Was helped in another thread - Created a windows system variable FORCE_COLOR and had it set to true, did not restart, and now I have colors in Git Bash (windows 7)



来源:https://stackoverflow.com/questions/41652866/windows-10-gitbash-not-formatting-colors-cant-find-configuration-settings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!