GitBash中文乱码解决
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