Home >Development Tools >git >What to do if git status is garbled in Chinese?

What to do if git status is garbled in Chinese?

藏色散人
藏色散人Original
2021-12-01 16:36:014552browse

Solution to the Chinese garbled code in git status: 1. Check the current workspace status; 2. Configure "core.quotepath" as "false"; 3. Change the git bash client text character set to the environment variable Encoding settings remain consistent.

What to do if git status is garbled in Chinese?

The operating environment of this article: Windows 7 system, Git version 2.30.0, Dell G3 computer.

What should I do if the git status is garbled in Chinese?

git status Chinese file names are garbled

When using git status to check the workspace status and git add to add files, sometimes you will find that using Files named in Chinese will be displayed as a string of numbers. For example, \346\265\213\350\257\225.txt. This situation is actually caused by garbled characters and can be solved through configuration.

1. Reproduce the scenario

Add test.txt in the working directory and view the current workspace status

What to do if git status is garbled in Chinese?

2. Solve the problem

Configure core.quotepath to false

$ git config --global core.quotepath false
# 在使用git log出现乱码上面一个设置不能解决问题需要再做以下设置
git config --global gui.encoding utf-8
git config --global i18n.commit.encoding utf-8
git config --global i18n.logoutputencoding utf-8
export LESSCHARSET=utf-8 # 添加到环境变量

# If the problem cannot be solved through the above settings, or the Chinese git log is still garbled. Check whether the text character set of the git bash client is consistent with the above settings. If the inconsistency is changed to be consistent

Let’s check the workspace status

What to do if git status is garbled in Chinese?

You can see that the Chinese name can be displayed normally.

Recommended learning: "Git Tutorial"

The above is the detailed content of What to do if git status is garbled in Chinese?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn