Home > Development Tools > git > body text

What to do if git status is garbled in Chinese?

藏色散人
Release: 2021-12-01 16:36:01
Original
4505 people have browsed it

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 # 添加到环境变量
Copy after login

# 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!

Related labels:
git
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template