Temporary Git cross-platform Chinese garbled solutions

Source: Internet
Author: User
Tags git client version control system

From http://blog.csdn.net/yang_hui1986527/article/details/6891319

 

Git is an excellent distributed version control system. It was initially tailored for Linux Kernel version management. Compared with other version control systems, it is stable, fast, cross-platform, easy to learn, and easy to use, with no cost required. For more advantages, see: http://whygitisbetterthanx.com/

The disadvantage is also a little obvious, that is, because the version control system is specially customized for the Linux kernel and does not develop versions of other platforms, it is used on other platforms to transplant the version of Git. Git is usually used in combination with msysGit and TortoiseGit on Windows. During the use of Git in Windows, we found that garbled characters may occur in one of the following situations:

1. Use Chinese notes for Log submission

2. The directory or file name contains Chinese characters

3. The code contains Chinese comments.

These problems are extremely obvious when used across platforms, causing great inconvenience to cross-platform code management. I am also suffering from this problem. I hope the official team can develop cross-platform versions as soon as possible to solve the garbled problem.

After my practice, I have summarized a set of temporary solutions to solve the above problems. The procedure is as follows:

Note: In Linux, UTF-8 is usually used for encoding. Therefore, in project management, UTF-8 is used for encoding.

1. Download and install msysGit and TortoiseGit

MsysGit: http://utf8-git-on-windows.googlecode.com/files/Git-1.7.3.2-utf8-20110213.exe

TortoiseGit: http://utf8-git-on-windows.googlecode.com/files/TortoiseGit-1.6.3.2-UTF8-32bit-20110127.msi

 

2. Add the following in the Git \ etc \ git-completion.bash file:
Alias ls = 'ls -- show-control-chars -- color = auto'
Purpose: Enter the ls command in Git Bash to display the Chinese file name normally.

 

3. Modify the two configurations in the Git \ etc \ inputrc file:
Set output-meta on
Set convert-meta off
Purpose: enable normal input of Chinese characters in Git Bash, such as Chinese commit log.
4. Add the following content to the Git \ etc \ profile file:

Export LESSCHARSET = UTF-8
Purpose: Unlike other vcs, the $ git log command rolls n logs from the beginning to the end. It will properly stop on the first page and press the space key to flip the page. This is achieved by sending logs to less processing. The preceding code sets less character encoding so that $ git log can display Chinese characters normally. In fact, its value does not have to be set to UTF-8, such as latin1 ....... Another method is $ git -- no-pager log. If pagination is disabled in the options, you do not need to set the above options.

5. Modify or add the following configuration in the C: Gitetcgitconfig file:
[Core]
Quotepath = false
Purpose: if this parameter is not provided, the output of $ git status is UNICODE encoded.

 

Note: 1. Use UTF-8 encoding, not GBK or others, whether in Windows or Linux.

For encoding settings in Eclipse, see setting encoding methods in Eclipse.

2. During version management, TortoiseGit and Git GUI should be used whenever possible, rather than Git Bash.

3. The above are only temporary solutions.

 

References:

1. Configuration of msysGit and http://blog.sina.com.cn/s/blog_6a5e34ad0100w23u.html of Chinese support

2. msysGit Chinese environment configuration and cross-platform development precautions http://baifa.me/2010/10/msysgit.html

3. Git Series II: The choice of Git client under Windows, and the solution to various Chinese problems of msysGit-reprinted http://www.cnblogs.com/baizx/archive/2010/08/09/1796120.html

4. Git Chinese garbled problem http://kongjian.baidu.com.cn/kazaff/blog/item/6a8384114cac7969cb80c42d.html

5. Solve Chinese garbled problem http://surpass-li.iteye.com/blog/679989 of Msysgit

Temporary Git cross-platform Chinese garbled solutions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.