git bash中不能显示中文

在git bash下查看状态中文文件名全部显示为数字,像这样:

pc@pc-PC MINGW64 ~/Desktop/项目笔记 (master)
$ git status
On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)

        "1. \346\236\204\345\273\272\347\274\226\350\257\221\347\216\257\345\242\203.doc"
        algorithms.c
        queue.h
        test.cpp
        "\346\226\260\345\273\272 Microsoft Word \346\226\207\346\241\243.doc"
        "\346\265\201\351\200\232\351\200\232\351\201\223\345\256\275\345\272\246\350\256\241\347\256\227.png"
        "\347\256\227\346\263\225.txt"
        "\347\256\227\346\263\225\345\233\276.xls"
        "\347\256\227\346\263\225\345\233\276\344\276\213.png"
        "\347\256\227\346\263\225\347\254\224\350\256\260.doc"

 

把git的配置改一下 git config --global core.quotepath false 就可以了:

pc@pc-PC MINGW64 ~/Desktop/项目笔记 (master)
$ git status
On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)

        1. 构建编译环境.doc
        algorithms.c
        queue.h
        test.cpp
        新建 Microsoft Word 文档.doc
        流通通道宽度计算.png
        算法.txt
        算法图.xls
        算法图例.png
        算法笔记.doc

nothing added to commit but untracked files present (use "git add" to track)

pc@pc-PC MINGW64 ~/Desktop/项目笔记 (master)

 

在 git log 时中文依然不能显示,首先试试用 git --no-pager log 能不能显示中文,如果可以,则设置pager为more: git config --global core.pager more 

 


 

以及,其他的一些解决办法:

进入你的项目根目录

1.设置git gui的界面编码

git config --global gui.encoding utf-8

2.设置 commit log 提交时使用 utf-8 编码,可避免服务器上乱码,同时与linux上的提交保持一致!

git config --global i18n.commitencoding utf-8

git config --global i18n.logoutputencoding utf-8

注:

windows系统默认编码为gbk,可改成gbk

如果系统设置了:

export LANG=zh_CN.UTF-8

则日志输出编码设置为utf-8

git config --global i18n.logoutputencoding utf-8

3.在 /etc/profile 中添加:

export LESSCHARSET=utf-8

在试一下问题解决了!



作者:风雷
链接:https://www.zhihu.com/question/57162172/answer/250442443
来源:知乎
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

 

转载于:https://www.cnblogs.com/fallenmoon/p/8659678.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值