git中文乱码

  1. etc\gitconfig: [gui] encoding = utf-8 [i18n] commitencoding = gbk [svn] pathnameencoding = gbk
    说明:打开 Git 环境中的中文支持。pathnameencoding设置了文件路径的中文支持。
  2. etc\git-completion.bash: alias ls='ls --show-control-chars --color=auto'
    说明:使得在 Git Bash 中输入 ls 命令,能够正常显示中文文件名。
  3. etc\inputrc: set output-meta on set convert-meta off
    说明:使得在 Git Bash 中能够正常输入中文,好比中文的 commit log。
  4. etc\profile: export LESSCHARSET=iso8859 #或者utf-八、gbk
    说明:$ git log 命令不像其它 vcs 同样,n 条 log 从头滚到底,它会恰当地停在第一页,按 space 键再日后翻页。这是经过将 log 送给 less 处理实现的。以上便是设置 less 的字符编码,使得 $ git log 能够正常显示中文。其实,它的值不必定要设置为 utf-8,好比 latin1 也能够……。还有个办法是 $ git –no-pager log,在选项里禁止分页,则无需设置上面的选项。
  5. git提示乱码 乱码情景:在cygwin中,使用git add添加要提交的文件的时候,若是文件名是中文,会显示形如274\232\350\256\256\346\200\273\347\273\223.png的乱码。
    解决方案: 在bash提示符下输入: git config --global core.quotepath false #core.quotepath设为false的话,就不会对0×80以上的字符进行quote,中文显示正常。
相关文章
相关标签/搜索