When using "Command Line Terminal" and "Git Bash" to type commands in the local Git repository, a series of numbers are displayed for the Chinese name file, as shown below:
This situation is usually caused by incorrect character encoding settings
Solution_
Set global character encoding
In Git Bash, you can use the following command to set the character encoding to UTF-8:
git config --global core.quotepath off
git config --global gui.encoding utf-8
git config --global i18n.commit.encoding utf-8
git config --global i18n.logoutputencoding utf-8
You can use git config --list to verify the configuration you just made .
Then use the "Command Line Terminal" to run it and you can display Chinese normally.
But "Git Bash" does not display a series of numbers, but displays Chinese garbled characters.
Here we also need to modify the Git Bash character encoding, just do as follows
Open the Git Bash terminal, then right-click on the title bar of the window and select "Options".
In the "Options" dialog box, select the "Text" tab.
In the "Locale" section, set the Character set to UTF-8.
Command explanation
The git config --global command is used to configure global settings in Git. These settings only apply to all Git repositories of the current user.
git config --global core.quotepath off
core.quotepath is a Git setting that controls whether quotes are used for file names. Setting it to off disables quotes so that Git does not add quotes when displaying file names.
This setting is usually used to solve the display problem of file names containing special characters or spaces in Git.
git config --global gui.encoding utf-8
gui.encoding is a Git setting that specifies the character encoding used in the Git graphical interface (GUI). Setting it to utf-8means use UTF-8 character encoding.
git config --global i18n.commit.encoding utf-8
i18n.commit.encoding is a Git setting that defines the character encoding of commit messages. Setting this to utf-8indicates that commit messages should use UTF-8 character encoding.
git config --global i18n.logoutputencoding utf-8
i18n.logoutputencoding is a setting of Git, which defines the character encoding of Git log output. Setting this to utf-8indicates that Git's output should use UTF-8 character encoding.