windows下git bash中文乱码问题

windows下git bash中文乱码问题

我的问题是,git bash 显示不出中文,输入中文或者是符号也会转译成反斜杠加3个数字的8进制 ASCII 编码

解决方法:

方法一:

git bash右键设置支持中文字符

在git bash窗口最上方点“右键”再选择“option”
选择“Text”-> "zh_CN"->"UTF-8",保存退出,这个时应该就可以正常输入和显示中文了

如果还是乱码请再执行下面步骤:
进入git安装目录,编辑etc\gitconfig文件,在文件末尾增加以下内容:

[gui]
encoding = utf-8 #代码库统一使用utf-8
[i18n]
commitencoding = utf-8 #log编码
[svn]
pathnameencoding = utf-8 #支持中文路径

编辑etc\profile文件,在文件末尾增加以下内容:

export LESSHARESET=utf-8
alias ls='ls --show-control-chars --color=auto' #ls能够正常显示中文

编辑etc\inputrc文件,修改output-meta和convert-meta属性值:

#disable/enable 8bit input
set input-meta on
set output-meta on
set convert-meta off

解决方法二:

git bash命令设置支持中文字符

在git bash输入如下命令:

git config --global gui.encoding utf-8
git config --global i18n.commitencoding utf-8
git config --global i18n.logoutputencoding utf-8
export LESSCHARSET=utf-8

 最后感谢作者: 轻丨尘

猜你喜欢

转载自blog.csdn.net/admin123404/article/details/106816333