安装git
1)windows
安装msysgit,下载地址:http://msysgit.github.io/
安装的时候,基本选择默认设置,但是:
在Adjusting your PATH environment页,勾选Run Git from the Windows Command Prompt
2)ubuntu
用命令“git --version”查看是否已安装,且版本为1.9.5或更高。若没安装或版本太低:
$ sudo apt-get install git-core git-gui git-doc gitk
3)mac
http://sourceforge.net/projects/git-osx-installer/,不仅能装Git本身(选1.9.5或以上版本),还有GUI的安装包
启动git
1)windows
Windows:使用Windows自带的命令行界面
可以在Windows自己的命令行界面下可以直接运行Git命令行,比如
D:/test> git help
当命令中有些特殊参数的时候,要加上双引号。比如
D:/test> git log HEAD^
特殊符号^会被Windows误解,所以要加双引号,写成
D:/test> git log "HEAD^"
Windows:使用msysGit自带的Bash
使用Bash就不用像上面那样加双引号了。启动Git Bash的简便方法是,在Windows Explorer里,适当目录的右键弹出菜单,Git Bash。此外,也可以从Windows开始菜单进入。
初次使用时,点击界面右上角,在菜单中选择“属性”项,在弹出对话框中,勾选上“快速编辑模式”和“插入模式”,这样将来copy paste比较方便。
注意,有利有弊,这个Bash对中文的支持不太好。
2)linux
$ git help
设置git
不论Windows还是Linux还是Mac,建议至少config下述内容
git config --global user.name "test" # 请换成你自己的名字,除非你凑巧也叫wukong.sun
git config --global user.email "test@163.com" # 同上
git config --