美文网首页
修复git diff正文中文乱码

修复git diff正文中文乱码

作者: 奥巴荣 | 来源:发表于2018-11-27 11:38 被阅读0次

Linux

git diff正文中文乱码

在命令行下输入以下命令:

$ git config --global core.quotepath false          # 显示 status 编码
$ git config --global gui.encoding utf-8            # 图形界面编码
$ git config --global i18n.commit.encoding utf-8    # 提交信息编码
$ git config --global i18n.logoutputencoding utf-8  # 输出 log 编码
$ export LESSCHARSET=utf-8
# 最后一条命令是因为 git log 默认使用 less 分页,所以需要 bash 对 less 命令进行 utf-8 编码

想长期生效的 话要改profile添加环境变量。

修复git diff正文中文乱码

Windows

在命令行下输入以下命令:

$ git config --global core.quotepath false          # 显示 status 编码
$ git config --global gui.encoding utf-8            # 图形界面编码
$ git config --global i18n.commit.encoding utf-8    # 提交信息编码
$ git config --global i18n.logoutputencoding utf-8  # 输出 log 编码

我使用cmd,直接添加环境变量LESSCHARSET,变量值utf-8,重启电脑让变量生效。

不重启电脑快速测试的话,cmd输入命令

set LESSCHARSET=utf-8

用Git bash的看参考二。

Windows修复git diff正文中文乱码

参考

解决 Git 在 windows 下中文乱码的问题
https://gist.github.com/nightire/5069597

g4e常见问题#4 解决Git在Windows上的中文乱码问题 | DevOps 博客
https://devopshub.cn/2018/01/07/g4e-faq-4-git-encoding-error/

相关文章

  • 修复git diff正文中文乱码

    Linux 在命令行下输入以下命令: 想长期生效的 话要改profile添加环境变量。 Windows 在命令行下...

  • windows git bash输出中文乱码问题处理

    修改git diff乱码: 持久化: 修改git bash安装目录下配置文件: 参考资料: 解决 msysGit(...

  • git 小技巧

    解决git status中文乱码问题

  • Git Status 中文乱码解决

    Git Status 中文乱码解决 解决:$ git config --global core.quotepath...

  • Git初学习

    1. Git Bash中文乱码 Windows下运行Git Bash中文乱码有两种形式(两个只能解决一个),一种是...

  • git常用命令和常见问题

    基本命令 clear 清屏 source tree Git界面化工具 git log 中文显示乱码 git 解决 ...

  • git记录

    Git Magic图解gitgit 学习笔记git游戏(学习)1、消除文档路径中文乱码git config --g...

  • git 基本操作

    git diff git diff,比较 working tree 与 staged 文件的区别。git diff...

  • win10 powerShell 执行git log乱码的解决方

    问题描述: 输入git log时,在git bash里能正常显示中文,然而在powerShell里就会中文乱码,如...

  • Git 配置问题

    git 修改配置 git中文改为英文提示 在.zshrc中添加如下配置,同时保证改为英文后,中文不乱码alias ...

网友评论

      本文标题:修复git diff正文中文乱码

      本文链接:https://www.haomeiwen.com/subject/ieqgqqtx.html