Git 颜色在 WSL 中通过 Ubuntu 不可见

Git color not visible through Ubuntu in WSL

感谢本教程,我已经修改了 shell 的颜色: https://medium.com/@jgarijogarde/make-bash-on-ubuntu-on-windows-10-look-like-the-ubuntu-terminal-f7566008c5c2

太棒了,但是,我在 GIT 上再也看不到我的活动分支了。

在属性中,我不明白如何选择正确的插槽来修改文本的颜色。

有人有想法吗?

我很久以前写了这个注册表文件,你可以试一试。如果您不介意,颜色会稍微调整一下。这对我来说很漂亮。

Windows Registry Editor Version 5.00

; Values stored as 00-BB-GG-RR
;[HKEY_CURRENT_USER\Console\%SystemRoot%_system32_bash.exe]
[HKEY_CURRENT_USER\Console\C:_Program Files_WindowsApps_CanonicalGroupLimited.UbuntuonWindows_1804.2018.817.0_x64__79rhkp1fndgsc_ubuntu.exe]
"CodePage"=dword:000001b5

; BLACK DGRAY
"ColorTable00"=dword:00240A30
"ColorTable08"=dword:00cfd7d3
; BLUE LBLUE
;"ColorTable01"=dword:00a46534
"ColorTable01"=dword:00cf9f72
"ColorTable09"=dword:00ffbf8e
; GREEN LGREEN
;"ColorTable02"=dword:00069a4e
"ColorTable02"=dword:0034e28a
"ColorTable10"=dword:0068ff9f
; CYAN LCYAN
;"ColorTable03"=dword:009a9806
"ColorTable03"=dword:00e2e234
"ColorTable11"=dword:00ffff68
; RED LRED
;"ColorTable04"=dword:000000cc
"ColorTable04"=dword:002929ef
"ColorTable12"=dword:005252ff
; MAGENTA LMAGENTA
;"ColorTable05"=dword:007b5075
"ColorTable05"=dword:00a87fad
"ColorTable13"=dword:00ff9aff
; YELLOW LYELLOW
;"ColorTable06"=dword:0000a0c4
"ColorTable06"=dword:004fe9fc
"ColorTable14"=dword:006fffff
; LGRAY WHITE
;"ColorTable07"=dword:00cfd7d3
"ColorTable07"=dword:00eceeee
"ColorTable15"=dword:00ffffff

将以上内容保存到扩展名为.reg的文本文件中,双击该文件。然后就可以看到效果了

另一种解决方案(如果您通过非 Microsoft Store 方式安装 WSL 尤其有用)是交换第一种和第三种颜色。第一种颜色应该是紫色,第三种颜色应该是绿色。请记住将屏幕背景和弹出窗口背景设置为第一种颜色。

这应该可以解决您的 git 颜色问题。

以上对我没有任何帮助,但我发现了一个简单的 git 配置颜色开关来解决 git 状态下深红色的可读性问题。

在 wsl ubuntu 终端内:

git config --global color.branch.remote "red bold"
git config --global color.status.untracked "red bold"
git config --global color.status.changed "red bold"