gitbash解决中文乱码

本文转自:

http://baixiaozheng.cn/2014/10/20/gitbash%E8%A7%A3%E5%86%B3%E4%B8%AD%E6%96%87%E4%B9%B1%E7%A0%81/

进入git安装目录,打开etc目录

1、编辑gitconfig文件,文件中增加内容

 
     
1
2
3
4
5
6
 
     
[gui]
encoding = utf- 8 #代码库统一使用utf-8
[i18n]
commitencoding = GB2312 #log编码,window下默认gb2312,声明后发到服务器才不会乱码
[svn]
pathnameencoding = GB2312 #支持中文路径

2、编辑git-completion.bash文件,文件中添加内容

 
     
1
 
     
alias ls= 'ls --show-control-chars --color=auto' # ls能够正常显示中文

3、编辑inputrc文件,修改output-meta 和 convert-meta属性值

 
     
1
2
 
     
set output-meta on #bash中可以正常输入中文
set convert-meta off

4、编辑profile文件,文件中添加内容

 
     
1
 
     
export LESSHARSET=utf- 8

猜你喜欢

转载自blog.csdn.net/piaopiaopiaopiaopiao/article/details/42236007