Windows GIT 解決中文顯示亂碼問題

終端機內無法輸入中文:

修改「C:\Program Files\Git\etc\inputrc」

#disable/enable 8bit input
set meta-flag on
set input-meta on
set output-meta on
set convert-meta off

ls 無法顯示中文目錄:

修改「C:\Program Files\Git\etc\profile」

#修正 ls 無法顯示中文目錄,新增下面這行
alias ls='ls --show-control-chars --color=auto'
#如果安裝的msysGit此設定已成預設值(bash_profile設定檔裏)

git log 無法顯示中文註解:

修改「C:\Program Files\Git\etc\profile」

#修正 git log 無法顯示中文註解
export LESSCHARSET=utf-8

修改修改「C:\Program Files\Git\etc\gitconfig」

#加入以下設定值
[gui]
    encoding = utf-8
[i18n]
    commitencoding = utf-8
    logoutputencoding = utf-8

此三項是 Windows GIT 常見的中文問題。

補充說明:
如果在msys裏無法正確顯示日文、韓文或是簡體中文,請在windows作業系統上安裝「unicode補完計畫」重新開機後,就可以正常於msys上顯示。

1 thoughts on “Windows GIT 解決中文顯示亂碼問題

  1. 引用通告: Git for windows 中文亂碼 | 太空猴子

發表留言