windows下git bash中文乱码解决办法

解决办法2:(在上述办法1中,如果在git  bash中,右键没有菜单的情况下)

进入git安装目录,通常是C:\Program Files (x86)\Git\

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

[plain] view plain copy
  1. [gui]  
  2.     encoding = utf-8  #代码库统一使用utf-8  
  3. [i18n]  
  4.     commitencoding = utf-8  #log编码  
  5. [svn]  
  6.     pathnameencoding = utf-8  #支持中文路径  

2. 编辑etc\git-completion.bash文件,在文件末尾增加以下内容:

[plain] view plain copy
 
 windows下git bash中文乱码解决办法windows下git bash中文乱码解决办法
  1. alias ls='ls --show-control-chars --color=auto'  #ls能够正常显示中文  


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

[plain] view plain copy
 
 windows下git bash中文乱码解决办法windows下git bash中文乱码解决办法
  1. set output-meta on  #bash可以正常输入中文  
  2. set convert-meta off  


4. 编辑profile文件,在文件末尾添加如下内容:

[plain] view plain copy
 
 windows下git bash中文乱码解决办法windows下git bash中文乱码解决办法

  1. export LESSHARESET=utf-8  

上诉都不行的话,可能是电脑编码问题。chcp查看电脑当前活动页

chcp 65001  就是换成UTF-8代码页

chcp 936 可以换回默认的GBK

chcp 437 是美国英语  

是437的话,就是你电脑本地、语言或者区域选错了。如下图修改

windows下git bash中文乱码解决办法