解决gitbash对中文的支持问题
# 问题描述
git bash中的中文显示有问题
# 解决方法
1、设置语言环境变量
# 临时生效 (仅当前窗口)
export LANG=zh_CN.UTF-8
export LC_ALL=zh_CN.UTF-8
1
2
3
2
3
若要永久生效,执行下面命令
echo "export LANG=zh_CN.UTF-8" >> ~/.bashrc
echo "export LC_ALL=zh_CN.UTF-8" >> ~/.bashrc
1
2
2
2、修改 Git 全局配置
# 1. 禁止对路径中的中文字符进行转义 (最核心)
git config --global core.quotepath false
# 2. 设置提交信息的编码为 UTF-8[reference:12][reference:13]
git config --global i18n.commitencoding utf-8
# 3. 设置日志输出的编码为 UTF-8[reference:14][reference:15]
git config --global i18n.logoutputencoding utf-8
1
2
3
4
5
6
2
3
4
5
6
# PS
在git bash中,路径之间是斜杠/,不是反斜杠\,如果之间复制的windows路径,记得替换一下。