git中文乱码问题

一、git log中文显示乱码
1、试试git --no-pager log
如果可以显示的话,把pager设置为more
git config --global core.pager more

2、修改编码
git config --global gui.encoding utf-8
git config --global i18n.commitencoding utf-8
git config --global i18n.logoutputencoding utf-8
git config --global core.quotepath false  #sourcetree中文预览乱码
或者vim ~/.gitconfig添加
[core]
     pager = more
     quotepath = false
[gui]
     encoding = utf-8
[i18n]
     commitencoding = utf-8
     logoutputencoding = utf-8

二、git bash中ls显示的中文名文本乱码
 export LANG="zh_CN.utf-8"
或者将之添加到~/.bash_profile中

三、git bash中的vim中文乱码
修改/etc/vimrc添加
set encoding=utf-8
let &termencoding=&encoding
set fileencodings=utf-8,gb2312,gbk,gb18030

四、修改mingw32客户端的编码
右键客户端,点击Options - Text
Locale中选择 zh_CN
Character set选择 UTF-8

猜你喜欢

转载自blog.csdn.net/zhifeng172/article/details/79880253
今日推荐