windows 下 git 中文亂碼解決

進入git安裝目錄,改一下配置就能夠基本解決: git

一、etc\gitconfig: bash

[gui]
     encoding = utf-8
[i18n]
     commitencoding = gbk
[svn]
     pathnameencoding = gbk

說明:打開 Git 環境中的中文支持。pathnameencoding設置了文件路徑的中文支持。 less

二、etc\git-completion.bash: svn

alias ls='ls --show-control-chars --color=auto'

說明:使得在 Git Bash 中輸入 ls 命令,能夠正常顯示中文文件名ui

三、etc\inputrc: 編碼

set output-meta on set convert-meta off

說明:使得在 Git Bash 中能夠正常輸入中文,好比中文的 commit log。 spa

四、etc\profile: code

export LESSCHARSET=iso8859 #或者utf-八、gbk

說明:$ git log 命令不像其它 vcs 同樣,n 條 log 從頭滾到底,它會恰當地停在第一頁,按 space 鍵再日後翻頁。這是經過將 log 送給 less 處理實現的。以上便是設置 less 的字符編碼,使得 $ git log 能夠正常顯示中文。其實,它的值不必定要設置爲 utf-8,好比 latin1 也能夠……。還有個辦法是 $ git –no-pager log,在選項裏禁止分頁,則無需設置上面的選項。 utf-8

相關文章
相關標籤/搜索