zl程序教程

您现在的位置是:首页 >  工具

当前栏目

git命令操作的时候,出现中文名显示问题

Git命令 操作 显示 出现 时候 问题
2023-09-27 14:25:29 时间

方法一:git config --global core.quotepath false

 

 

方法二:

Windows系统的Git默认是不支持中文显示的,需要进行一系列的设置才能避免乱码的出现,下面总结如何配置Git使其支持中文显示。

Git bash options UTF-8编码配置
1.首先进入git bash终端,右键,选择options:

2.然后,将Text配置成如下图所示:


Git 支持 utf-8 编码配置
1.在命令行下输入以下命令:

$ 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 编码

2.ls 命令可以显示中文名称

修改C:\Program Files (x86)\Git\mingw32\share\git\completion\ git-completion.bash 文件,如下:

/# 在文件末尾处添加一行

alias ls="ls --show-control-chars --color"