Windows下Git Bash中文亂碼


文章轉自:http://ideabean.iteye.com/blog/2007367

打開Git Bash

 

進入目錄:$ cd /etc

 

1. 編輯 gitconfig 文件:$ vi gitconfig

      文件中增加內容

Xml代碼   收藏代碼
  1. [gui]  
  2. encoding = utf-8 #代碼庫統一使用utf-8  
  3. [i18n]  
  4. commitencoding = GB2312 #log編碼,window下默認gb2312,聲明后發到服務器才不會亂碼  
  5. [svn]  
  6. pathnameencoding = GB2312 #支持中文路徑  

 

2. 編輯 git-completion.bash 文件:$ vi git-completion.bash

    最下面添加

Xml代碼   收藏代碼
  1. alias ls='ls --show-control-chars --color=auto' #ls能夠正常顯示中文  

 

3. 編輯 inputrc 文件:$ vi inputrc

    修改 output-meta 和 convert-meta 屬性值

Xml代碼   收藏代碼
  1. set output-meta on #bash中可以正常輸入中文  
  2. set convert-meta off  

 

4. 編輯 profile 文件:$ vi profile

    最下面添加

Xml代碼   收藏代碼
  1. export LESSHARSET=utf-8  

 

5. 重新編譯配置文件,使文件生效

    $ source git-completion.bash

    $ source inputrc

    $ source profile


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM