Git bash下中文乱码 —— 解决方案

解决方案1:

  • 在git bash下,右键 出现下图,选择options:
    Git bash下中文乱码问题

  • 选择“Text”
    Git bash下中文乱码问题

  • Character set设置为 UTF-8
    Git bash下中文乱码问题


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

  • 进入git安装目录,通常是C:\Program Files (x86)\Git\
  • 编辑etc\gitconfig文件,在文件末尾增加以下内容:
[gui]  
    encoding = utf-8  #代码库统一使用utf-8  
[i18n]  
    commitencoding = utf-8  #log编码  
[svn]  
    pathnameencoding = utf-8  #支持中文路径  

  • 编辑etc\git-completion.bash文件,在文件末尾增加以下内容:
alias ls='ls --show-control-chars --color=auto'  #ls能够正常显示中文 
  • 编辑etc\inputrc文件,修改output-metaconvert-meta属性值:
set output-meta on  #bash可以正常输入中文  
set convert-meta off  
  • 编辑profile文件,在文件末尾添加如下内容:
export LESSHARESET=utf-8  

相关文章:

  • 2021-11-14
  • 2022-12-23
  • 2021-12-08
  • 2021-10-14
  • 2021-08-20
  • 2021-08-15
  • 2021-12-11
猜你喜欢
  • 2021-06-26
  • 2022-12-23
  • 2021-12-05
  • 2022-12-23
  • 2021-11-20
  • 2021-10-10
  • 2021-04-02
相关资源
相似解决方案