When developing software, a version management system is essential. Git is an open source distributed version control system, the most important part of which is configuring the Git environment. Different from the general configuration, Git also needs to set the Chinese character set to avoid garbled Chinese characters. This article will introduce in detail how to set the Chinese character set in Git.
First, open Git Bash and enter the following commands for basic configuration:
$ git config --global user.name "Your Name" $ git config --global user.email "your_email@example.com"
The first command is to set the Git user name, and the second command is to set the user email. You can also replace --global
with the --local
parameter here, which means that only the current project will be configured.
Next, set Git to use UTF-8 encoding, because UTF-8 is currently the most commonly used encoding method:
$ git config --global i18n.commitencoding utf-8 $ git config --global i18n.logoutputencoding utf-8
These two commands set the encoding of commit information and log output respectively. The encoding method is UTF-8.
Then, set Git to use the Chinese character set, use the following command:
$ git config --global core.quotepath false $ git config --global gui.encoding utf-8 $ git config --global utf8.auto false
Among them, the core.quotepath
command means to escape the Chinese in the path, ## The #gui.encoding command indicates that the encoding method used by Git Gui is UTF-8, and the
utf8.auto command indicates that Chinese characters in the path name are disabled and displayed intact.
$ git config --system --unset credential.helper
The above is the detailed content of How to set the Chinese character set in Git. For more information, please follow other related articles on the PHP Chinese website!