GitBash中文乱码解决

本文介绍了在Windows环境下GitBash出现中文乱码的问题及其解决方法。通过修改GitBash的locale设置为UTF-8,并配置git的core.quotepath参数,成功解决了在Git操作中显示中文文件名时的乱码问题。
摘要由CSDN通过智能技术生成

GitBash中文乱码解决

window使用命令行就是各种坑,特别是中文乱码非常常见

icehill@LAPTOP-NOEK2LVK MINGW64 /d/code/gitbook-notes (master)
$ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        new file:   "\351\235\242\350\257\225\351\242\230\347\233\256/leadCodeSolution/num2-\344\270\244\346\225\260\347\233\270\345\212\240\357\274\210\351\223\276\350\241\250\357\274\211.md"
        new file:   "\351\235\242\350\257\225\351\242\230\347\233\256/leadCodeSolution/num3-\346\227\240\351\207\215\345\244\215\345\255\227\347\254\246\347\232\204\346\234\200\351\225\277\345\255\220\344\270\262.md"
        modified:   "\351\235\242\350\257\225\351\242\230\347\233\256/\345\270\270\350\247\201\347\256\227\346\263\225\351\242\230.md"
        modified:   "\351\235\242\350\257\225\351\242\230\347\233\256/\351\235\242\350\257\225\351\242\230\347\233\2564.md"

解决办法

点击左上角gitbash终端图标,然后点选项=>文本=>设置locale本地字符集,选utf-8或者GBK,这个设置了,应该在终端执行命令例如:ls就不会乱码了,但是如果git status还是乱码,可以尝试以下命令

$ git config --global core.quotepath false

效果

$ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        new file:   技术文章/GitBash中文乱码解决.md

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   技术文章/GitBash中文乱码解决.md
        modified:   技术文章/空循环为什么会让CPU占用100%.md

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值