git status中文乱码问题

发布: 2012-03-28 11:23

默认情况下,使用git status显示的中文文件如下:

$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
# Changes to be committed:
# (use "git reset HEAD ..." to unstage)
#
# new file: "\350\265\204\346\272\220\345\272\223\347\263\273\347\273\237\346\236\266\346\236\204\345\233\276.odg"
#
# Changes not staged for commit:
# (use "git add ..." to update what will be committed)
# (use "git checkout -- ..." to discard changes in working directory)
#
# modified: "\345\267\245\344\275\234\350\256\260\345\275\225.odt"
# modified: "\350\265\204\346\272\220\345\272\223\347\263\273\347\273\237\350\256\276\350\256\241\346\226\271\346\241\210(\347\254\254\344\270\211\347\211\210).doc"
#

需要设置一下git,让其按正确的编码显示文件名:

git config --global gui.encoding utf-8
git config --global i18n.commitencoding utf-8
git config --global i18n.logoutputencoding gbk
git config --global core.quotepath false

经测试该配置可用。


原文: http://qtchina.tk/?q=node/645

Powered by zexport