这里记录Git for Windows 1.8.3 在Windows XP SP3 上的设置。
这些设置也应适用于Git for Windows 1.7.10及以后的版本,但不适用于1.7.10以前的版本。因为1.7.10及以后的版本的Git repositories才原生支持Unincode。
[b][color=blue]解决问题的总的思路[/color][/b]
能用Unicode的地方都用Unicode。
[b][color=blue]已知问题[/color][/b]
•MSYS bash 不能输入中文(MSYS尚不能完全支持Unicode),但有替代办法(workaround)。
[b][color=blue]下载Git for Windows 1.8.3[/color][/b]
前往 http://git-scm.com/download/win 下载最新版Git for Windows 1.8.3。现时的最新版是Git-1.8.3-preview20130601.exe
[b][color=blue]安装选项[/color][/b]
•在 Select Components 中,选定 Use a TrueType font in all console window (not only for Git Bash)
•在 Adjusting your PATH environment 中,选定 Run Git from the windows Command Prompt\
•其他选项保留缺省值
[b][color=blue]解决MSYS bash 中ls 中文显示???问题[/color][/b]
编辑 etc\git-completion.bash,在最后加入
[b][color=blue]解决git status 乱码[/color][/b]
[b][color=blue]解决gitk显示文件内容中文乱码[/color][/b]
在%git%\etc\gitconfig文件末尾添加:
[b][color=blue]MSYS bash中不能输入中文的替代办法[/color][/b]
•不使用MSYS bash,使用windows自带的Command Prompt。经测试,在CMD中输入中文一切正常。
•使用MSYS bash,但在commit 时,使用 git -m,调用vim,在vim中输入中文。经测试,在bash 中的vim中输入中文一切正常。
•使用TortoiseGit。TortoiseGit是Windows 的Git GUI。支持unicode,在测试中尚未发现对中文支持的问题。安装步骤如下: •确保Git for Windows 最新版已安装好
•前往https://code.google.com/p/tortoisegit/wiki/Download?tm=2
•下载并安装TortoiseGit最新版
•下载并安装Chinese, simplified Language Pack
[b][color=blue]编辑器的选择[/color][/b]
至此 Git for Windows 的中文文件名、中文注释等问题均已解决。但文件的内容是GBK还是Unicode是由编辑器决定的。建议使用gvim或UltraEdit32等支持Unicode的编辑器编辑文件,这样可以和Linux和Mac上的项目无缝同步。
参考资料
•[url=http://zengrong.net/post/1722.htm]Git for Windows Unicode Support[/url]
•[url=http://blog.crhan.com/2012/09/git-status-%E4%B8%AD%E6%96%87%E4%B9%B1%E7%A0%81%E8%A7%A3%E5%86%B3/]Git Status 中文乱码解决[/url]
•[url=http://zengrong.net/post/1249.htm]zrong’s Blog??git乱码解决方案汇总[/url]
•[url=http://zengrong.net/post/1722.htm]zrong’s Blog 使用Git、Git GUI和TortoiseGit[/url]
•[url=http://guides.beanstalkapp.com/version-control/git-on-windows.html]Working with Git on Windows[/url]
这些设置也应适用于Git for Windows 1.7.10及以后的版本,但不适用于1.7.10以前的版本。因为1.7.10及以后的版本的Git repositories才原生支持Unincode。
[b][color=blue]解决问题的总的思路[/color][/b]
能用Unicode的地方都用Unicode。
[b][color=blue]已知问题[/color][/b]
•MSYS bash 不能输入中文(MSYS尚不能完全支持Unicode),但有替代办法(workaround)。
[b][color=blue]下载Git for Windows 1.8.3[/color][/b]
前往 http://git-scm.com/download/win 下载最新版Git for Windows 1.8.3。现时的最新版是Git-1.8.3-preview20130601.exe
[b][color=blue]安装选项[/color][/b]
•在 Select Components 中,选定 Use a TrueType font in all console window (not only for Git Bash)
•在 Adjusting your PATH environment 中,选定 Run Git from the windows Command Prompt\
•其他选项保留缺省值
[b][color=blue]解决MSYS bash 中ls 中文显示???问题[/color][/b]
编辑 etc\git-completion.bash,在最后加入
alias ls='ls --show-control-chars --color=auto'[b][color=blue]解决git status 乱码[/color][/b]
git config --global core.quotepath false[b][color=blue]解决gitk显示文件内容中文乱码[/color][/b]
在%git%\etc\gitconfig文件末尾添加:
[gui]
encoding = utf-8
[i18n]
commitencoding = {utf-8|gbk}[b][color=blue]MSYS bash中不能输入中文的替代办法[/color][/b]
•不使用MSYS bash,使用windows自带的Command Prompt。经测试,在CMD中输入中文一切正常。
•使用MSYS bash,但在commit 时,使用 git -m,调用vim,在vim中输入中文。经测试,在bash 中的vim中输入中文一切正常。
•使用TortoiseGit。TortoiseGit是Windows 的Git GUI。支持unicode,在测试中尚未发现对中文支持的问题。安装步骤如下: •确保Git for Windows 最新版已安装好
•前往https://code.google.com/p/tortoisegit/wiki/Download?tm=2
•下载并安装TortoiseGit最新版
•下载并安装Chinese, simplified Language Pack
[b][color=blue]编辑器的选择[/color][/b]
至此 Git for Windows 的中文文件名、中文注释等问题均已解决。但文件的内容是GBK还是Unicode是由编辑器决定的。建议使用gvim或UltraEdit32等支持Unicode的编辑器编辑文件,这样可以和Linux和Mac上的项目无缝同步。
参考资料
•[url=http://zengrong.net/post/1722.htm]Git for Windows Unicode Support[/url]
•[url=http://blog.crhan.com/2012/09/git-status-%E4%B8%AD%E6%96%87%E4%B9%B1%E7%A0%81%E8%A7%A3%E5%86%B3/]Git Status 中文乱码解决[/url]
•[url=http://zengrong.net/post/1249.htm]zrong’s Blog??git乱码解决方案汇总[/url]
•[url=http://zengrong.net/post/1722.htm]zrong’s Blog 使用Git、Git GUI和TortoiseGit[/url]
•[url=http://guides.beanstalkapp.com/version-control/git-on-windows.html]Working with Git on Windows[/url]
3769

被折叠的 条评论
为什么被折叠?



