- 解释:
Windows PowerShell中的Git乱码通常是因为字符编码不正确或Git配置不支持Windows系统的默认编码导致的。Git在处理文件时可能使用UTF-8编码,而Windows系统的命令行工具(如PowerShell)默认使用的是Windows-1252或GBK编码。
- 解决方法:
1、设置Git默认编码:
打开Git Bash,执行以下命令:
git config --global core.quotepath false
git config --global gui.encoding utf-8
git config --global i18n.commit.encoding utf-8
git config --global i18n.logoutputencoding utf-8
2、修改PowerShell的默认编码为UTF-8:
打开PowerShell,执行以下命令: