1. When using the git add command to add files with Chinese characters in the file name
Garbled like:
\304\261\276\304\265 \265.txt
Solution:
Edit the corresponding line in the C:\Git\etc\inputrc file,
Look for the following 2 lines and modify their values.
Original:
set output-meta offset Convert-meta on
Switch
set output-metaonset Convert-meta off
2. When using git log to view log information containing Chinese
Garbled like:
<E4><BF><AE><E6><94><B9><E6><$ ><87 ><E6><9C><AC><E6><>< ><E6><A1> <A3>
Solution:
At the bash prompt, enter:
git config--global i18n.commitencoding utf-8--global I18n.logoutputencoding GBK
Note: You can avoid garbled Linux servers by using UTF-8 encoding when setting commit commits, and also set the Utf-8 encoding to GBK encoding when you execute git log to solve garbled problems.
To edit the C:\Git\etc\profile file, add the following line:
Export lesscharset=utf-8
Note: To enable git log to display Chinese correctly (requires mates: i18n.logoutputencoding GBK)
3. When using the LS command to see the file names containing Chinese characters garbled
Garbled like:
????. Txt
Solution:
Use the ls–show-control-chars command to force the display of file names using console character encoding to view Chinese file names.
For ease of use, you can edit the C:\Git\etc\git-completion.bash file and add the following line:
Alias ls="ls--show-control-chars"
4. When viewing UTF-8 encoded text files in the Git GUI
Garbled like:
Nobelium à Andychia po Jean £
Solution:
At the bash prompt, enter:
git config--global gui.encoding utf-8
Note: Through the above settings, UTF-8 encoded text files can be viewed normally, but GBK encoded files will be garbled, so still did not fundamentally solve the problem.
One possible way is to unify the encoding of all text files to UTF-8 or GBK, and then set the corresponding gui.encoding parameter to Utf-8 or GBK.
Git for Windows Chinese garbled solution