Git bash下中文亂碼 —— 解決方案
解決方案1:
-
在git bash下,右鍵 出現下圖,選擇options:

-
選擇“Text”

-
將
Character set設置為 UTF-8

解決方案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-meta和convert-meta屬性值:
set output-meta on #bash可以正常輸入中文
set convert-meta off
- 編輯profile文件,在文件末尾添加如下內容:
export LESSHARESET=utf-8
