Windows下Git Bash乱码问题解决

Windows下Git Bash乱码问题解决

缘起

个人用的电脑是Mac OS,系统和终端编码都是UTF-8,但公司给配发的电脑是Windows,装上Git Bash在使用 git commit -m "中文"时会乱码

解决

  1. 确认有以下配置
shell 复制代码
# 输入
git config --global --list
# 展示
core.quotepath=false
gui.encoding=utf-8
i18n.commit.encoding=utf-8
i18n.logoutputencoding=utf-8
i18n.commitencoding=utf-8

没有的话就配置:

shell 复制代码
git config --global core.quotepath false
git config --global gui.encoding utf-8
git config --global i18n.commitencoding utf-8
git config --global i18n.logoutputencoding utf-8
  1. 本地配置也要设置
shell 复制代码
git config --local core.quotepath false
git config --local gui.encoding utf-8
git config --local i18n.commitencoding utf-8
git config --local i18n.logoutputencoding utf-8
  1. 页面配置
    Git bash上工具栏右键 ->Options -> Text -> encoding,然后选择utf-8
相关推荐
略懂而已7 小时前
腾讯云COS 自动同步 for windows
windows·云计算·腾讯云
鬼手点金8 小时前
Agent 的学习机制:后训练、上下文学习与外部化学习
java·人工智能·git·学习·自动化·nanogpt
weixin199701080169 小时前
《抖音商品API:/product/detail 与 /product/list 的字段边界与图片合规踩坑》(附 Python 源码)
服务器·网络·windows
小杍随笔9 小时前
egui 0.37 升级实录:卡顿修复与5倍性能回退
windows·rust·egui
aichitang202412 小时前
QCU 2.0.0:补齐 Windows、Linux 与 GNOME Wayland
linux·运维·windows·ai·agent·ai编程
唐钰小宝B13 小时前
深度解读 JDK 8、JDK 11、JDK 17 和 JDK 21 的区别
java·开发语言·windows
金融小师妹14 小时前
多因子时间序列分析:美元与美债收益率变化对黄金价格+1.6%的影响
c语言·人工智能·git·决策树·pyqt
北风toto14 小时前
Windows 下用 OpenSSL 生成 SSL 密钥并配置 Nginx 教程
windows·nginx·ssl
2601_9623649714 小时前
升级电脑人脸登录,选购 Windows Hello 模组常见误区
windows·安全·电脑
小陈不好吃14 小时前
Java 泛型与类型擦除:从 PECS 原则到 TypeToken 绕过
java·开发语言·windows·pecs 原则·typetoken绕过