跳到主要內容

Git for Windows中文檔名不再亂碼

昨天看到 Getting Started with Git in Visual Studio and Team Foundation Service,也就是說微軟官方將正式支援Git做為Source Control Provider。目前需要安裝Visual Studio 2012 Update 2 CTP 2Visual Studio Tools for Git。所以我也趁機丟掉Subversion,全面投到Git的懷抱。



其實在Git v1.7.10之後,就修改Windows版本儲存時會用UTF-8處理檔名,只是要做些設定,詳情請參考Git for Windows Unicode Support。它和中國高手做的patch是一樣的,在所有平台都會使用UTF-8處理檔名! 從此在各平台都可順利開發共用repository。我個人是不喜歡Git去改我的line ending,詳情看Dealing with line endings

以下節錄Github的說明:

Windows settings

Console font (per user)

The default console font does not support Unicode. Change the console font to a TrueType font such as Lucida Console or Consolas. The setup program can do this automatically, but only for the installing user.

Git settings

These can be set per user (with the --global option) or per repository, the repository settings take precedence.

Disable quoted file names

By default, git will print non-ASCII file names in quoted octal notation, i.e. "\nnn\nnn...". This can be disabled with
 git config [--global] core.quotepath off

Disable commit message transcoding

Previous Git for Windows required to set the i18n.logoutputencoding to your Windows system's default OEM encoding for proper console output of non-ASCII commit messages. This is no longer necessary. Remove this or set it to 'utf-8':
 git config [--global] --unset i18n.logoutputencoding
The i18n.commitencoding setting should also be removed or set to 'utf-8' to support commit messages on the command line (git commit -m "..." from cmd.exe, MSYS bash won't let you enter non-ASCII characters):
 git config [--global] --unset i18n.commitencoding

Disable SVN file name transcoding

If you're using git-svn, reencoding SVN file names is no longer necessary (SVN also stores file names in UTF-8):
 git config [--global] --unset svn.pathnameencoding

Migrating old Git for Windows repositories

This is only relevant if you used non-ASCII file names with non-Unicode Git for Windows versions.
Previous Git for Windows versions stored file names in the default encoding of the originating Windows system, making these repositories incompatible with other Windows language-versions and other Git versions (including Cygwin-Git and JGit / EGit on Windows).
The Unicode-enabled Git for Windows stores file names UTF-8 encoded.

Checking if a repository contains non-ASCII file names

The recodetree check command scans the entire history of a git repository and prints all non-ASCII file names. If the output is empty, no migration is necessary.
Note: the recodetree script doesn't work with quoted characters, disable quoted file names first: git config [--global] core.quotepath off

留言

這個網誌中的熱門文章

DBeaver 介面語言

DBeaver是我個人頗常用的一套跨平台Database管理工具,最近升級後發現Windows版本居然變成簡體中文,而且無法切換為英文。

Personal Bookmark

Java SE 6 + Firefox 2 UI 問題 As I do . Google拋棄了了SOAP API,浮想聯翩 https://www.gandi.net/ VS 2005 SP1中文版推出 Windows Vista中文版下載 ASP.NET 2.0網頁執行管線與快取原理 Cache 2.0快取架構與快取資料自動移除架構圖 flickr sync 分享與試用 SUN Looking Glass 3D圖形介面發布1.0 雅虎勵精圖治推動改革 Wait and see 國內某SOC疑遭駭客入侵 大砲開講 Very Important! 微軟公佈Vista安全程式介面草案 一窺Google開原碼庫房乾坤 qing is writing a dig girl net... wait and see

自然人憑證讀卡機驅動程式

鳥毅用的是第一代的自然人憑證讀卡機,EZ100PU(後來有同事買EZmini可以讀SIM卡似乎更好),每年報稅時用一次。 本來只是要申請些政府業務,一時之間找不到光碟,沒想到在 驅動程式下載 居然看到Linux和Mac的驅動程式,剩下的就是政府單位的網頁和程式應該改版了吧!!!