尝试将终端的Git Bash选项更改为xterm-256color。归功于:http://www.techhelp.pw/git-bash-using-laravel-artisan-displays-escaped-characters/
另一种选择是使用--no-ansi
开关运行Laravel脚本,该开关完全禁用ANSI代码。
看起来颜色代码没有正确显示:
[34m
是蓝色前景,[39m
是默认前景色。
但是你需要一个带前缀的转义字符:
在Bash中,可以使用以下语法获取<Esc>字符:
- \和
- \033
- \ X1B
在这里查看更多:http://misc.flogisoft.com/bash/tip_colors_and_formatting
这里也讨论了同样的问题:ANSI color escape sequences seem broken for arc in git bash on windows
基本上提到了hackish修复:
php artisan tinker | cat
php artisan tinker | echo -e
其他一些资源:
ANSI color in git is not displayed correctly In Git Bash on Windows 7, Colors display as code when running Cucumber or rspec
列出的解决方案都没有为我工作,在Git / etc / bash.bashrc中添加这些行解决了这个问题。
# remove the winpty PHP aliases
unalias $(alias | grep winpty | grep php | cut -d"=" -f1 | cut -d" " -f2)
# support ansi color
export ANSICON=true
我在https://blog.kmelia.net/testing/coloration-dans-git-bash/123找到了解决方案
我在Windows 10上使用git bash for windows,我的git版本是2.21.0
希望这可以帮助
解决颜色问题下载并安装此https://github.com/adoxa/ansicon
安装步骤:
1)Extract The folder and Navigate to x86/64 (Depends upon your system) 2)Open Cmd 3)ansicon.exe -I
简单:)
这是GIT版本的兼容性问题。 在我的情况下,删除最新版本并下载并安装GIT版本2.10。问题解决了。 https://github.com/git-for-windows/git/releases/tag/v2.10.0.windows.1