Git garbled solution in Windows

Source: Internet
Author: User

To solve the GIT garbled problem, almost all git garbled on the InternetArticleAfter reading it, I finally solved it.

My git and tortoisegit versions:

Msysgit: v1.7.9

Http://msysgit.googlecode.com/files/Git-1.7.9-preview20120201.exe

Tortoisegit: v1.7.7.0

Http://tortoisegit.googlecode.com/files/TortoiseGit-1.7.7.0-32bit.msi

We found that the solutions for different versions are still different. I tried the latest version and found that none of them can be achieved by using the online method. Later, I went to the old version, and everything was okay.

Below is my configuration file

C: \ Documents ents and Settings \ Administrator \. gitconfig
[Http]
Sslverify = false
[User]
Name = xxx
Email = xxx@xxx.com
[Alias]
Ci = commit-a-s
CO = checkout
St = status-
Praise = blame
Am3 = am -- signoff -- 3way -- ignore-space-change -- keep-Cr
[I18n]
Logoutputencoding = GBK
Commitencoding = UTF-8
[Core]
Editor = Emacs
Quotepath = false
Autocrlf = false
[GUI]
Encoding = UTF-8
[Diff]
External = E:/git-diff-wrapper.sh
[SVN]
Pathnameencoding = GBK

 

By the way, the diff I used is winmerge, and the bc I used was blacklisted. I don't want to worry about it anymore. I just used open source directly.

E:/git-diff-wrapper.sh

#! /Bin/sh

# Diff is called by git with 7 parameters:
# Path old-file old-hex old-Mode New-file new-hex New-Mode

# "C:/program files/beyond compare 3/bcompare.exe" "$2" "$5" | cat
"C:/program files/winmerge/winmergeu.exe"-e-UB "$2" "$5" | cat

C: \ Program Files \ git \ etc \ git-completion.bash

Add a row

Alias ls = 'ls -- show-control-chars -- color = auto'

C: \ Program Files \ git \ etc \ gitconfig

[Core]
Symlinks = false
Autocrlf = false
[Color]
Diff = auto
Status = auto
Branch = auto
Interactive = true
[Pack]
Packsizelimit = 2G
[Help]
Format = html
[Http]
Sslcainfo =/bin/curl-ca-bundle.crt
[Sendemail]
Smtpserver =/bin/msmtp.exe

[Diff "astextplain"]
Textconv = astextplain
[Rebase]
Autosquash = true

C: \ Program Files \ git \ etc \ inputrc

Set meta-flag on
Set input-meta on
Set output-meta on
Set convert-meta off

C: \ Program Files \ git \ etc \ Profile

Add a row

Export lesscharset = UTF-8

 

The editor I use is Emacs in windows. It is very useful. However, there are also garbled characters. During commit in git bash, if the comment is input in Chinese, it may not be converted to UTF-8, which may be related to the default encoding used to open commit_editmsg in the editor, when commit_editmsg contains a Chinese file name, the Emacs encoding is always C (u), that is, Chinese-GBK-Unix. This causes the committed comments to be garbled elsewhere. I thought of a stupid way. Every time I load a file in the Emacs configuration file, I set to use UTF-8 encoding:

C: \ Documents ents and Settings \ Administrator\. Emacs

 
(Defun set_encode_my ()(Set-Buffer-file-coding-System'UTF-8)) (Add-Hook'Find-file-hook'Set_encode_my)

 

 

Related Article

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.