Mac 安装 Git
Mac 本身就有 Git 了
1 | $ which git |
Mac 还没有安装 Git
使用homebrew来安装 Git - command line
安装 homebrew
安装 homebrew,安装后
1
2
3
4$ which brew
/usr/local/bin/brew
$ brew --version
Homebrew 0.9.5 (git revision e15a; last commit 2016-02-03)
然后就安装好了。。。
Git 官网的方式安装
官方文档的方式安装 - http://git-scm.com/
Windows 安装 Git
1. 来源于廖雪峰的Git教学网站
实话实说,Windows是最烂的开发平台,如果不是开发Windows游戏或者在IE里调试页面,一般不推荐用Windows。不过,既然已经上了微软的贼船,也是有办法安装Git的。
– 来源于廖雪峰的 Git 教学
Windows下要使用很多Linux/Unix的工具时,需要Cygwin这样的模拟环境,Git也一样。Cygwin的安装和配置都比较复杂,就不建议你折腾了。不过,有高人已经把模拟环境和Git都打包好了,名叫msysgit,只需要下载一个单独的exe安装程序,其他什么也不用装,绝对好用。
msysgit是Windows版的Git,从http://msysgit.github.io/下载,然后按默认选项安装即可。
安装完成后,在开始菜单里找到“Git”->“Git Bash”,蹦出一个类似命令行窗口的东西,就说明Git安装成功!
安装完成后,还需要最后一步设置,在命令行输入:
1 | $ git config --global user.name "Your Name" |
因为Git是分布式版本控制系统,所以,每个机器都必须自报家门:你的名字和Email地址。你也许会担心,如果有人故意冒充别人怎么办?这个不必担心,首先我们相信大家都是善良无知的群众,其次,真的有冒充的也是有办法可查的。
注意git config命令的–global参数,用了这个参数,表示你这台机器上所有的Git仓库都会使用这个配置,当然也可以对某个仓库指定不同的用户名和Email地址。
2.官网的教学方法
Linux 安装 Git
- 不同的版本有不同包管理工具
- 我使用的是
Centos
安装Git1
$ sudo yum install -y git //然后输入你的 password
安装过程1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.btte.net
* extras: mirrors.pubyun.com
* updates: mirrors.btte.net
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package git.x86_64 0:1.7.1-3.el6_4.1 will be installed
--> Processing Dependency: perl-Git = 1.7.1-3.el6_4.1 for package: git-1.7.1-3.el6_4.1.x86_64
--> Processing Dependency: rsync for package: git-1.7.1-3.el6_4.1.x86_64
--> Processing Dependency: perl(Git) for package: git-1.7.1-3.el6_4.1.x86_64
--> Processing Dependency: perl(Error) for package: git-1.7.1-3.el6_4.1.x86_64
--> Processing Dependency: openssh-clients for package: git-1.7.1-3.el6_4.1.x86_64
--> Running transaction check
---> Package openssh-clients.x86_64 0:5.3p1-112.el6_7 will be installed
--> Processing Dependency: openssh = 5.3p1-112.el6_7 for package: openssh-clients-5.3p1-112.el6_7.x86_64
--> Processing Dependency: libedit.so.0()(64bit) for package: openssh-clients-5.3p1-112.el6_7.x86_64
---> Package perl-Error.noarch 1:0.17015-4.el6 will be installed
---> Package perl-Git.noarch 0:1.7.1-3.el6_4.1 will be installed
---> Package rsync.x86_64 0:3.0.6-12.el6 will be installed
--> Running transaction check
---> Package libedit.x86_64 0:2.11-4.20080712cvs.1.el6 will be installed
---> Package openssh.x86_64 0:5.3p1-94.el6 will be updated
--> Processing Dependency: openssh = 5.3p1-94.el6 for package: openssh-server-5.3p1-94.el6.x86_64
---> Package openssh.x86_64 0:5.3p1-112.el6_7 will be an update
--> Running transaction check
---> Package openssh-server.x86_64 0:5.3p1-94.el6 will be updated
---> Package openssh-server.x86_64 0:5.3p1-112.el6_7 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
git x86_64 1.7.1-3.el6_4.1 base 4.6 M
Installing for dependencies:
libedit x86_64 2.11-4.20080712cvs.1.el6 base 74 k
openssh-clients x86_64 5.3p1-112.el6_7 updates 438 k
perl-Error noarch 1:0.17015-4.el6 base 29 k
perl-Git noarch 1.7.1-3.el6_4.1 base 28 k
rsync x86_64 3.0.6-12.el6 base 335 k
Updating for dependencies:
openssh x86_64 5.3p1-112.el6_7 updates 274 k
openssh-server x86_64 5.3p1-112.el6_7 updates 324 k
Transaction Summary
================================================================================
Install 6 Package(s)
Upgrade 2 Package(s)
Total download size: 6.1 M
Downloading Packages:
--------------------------------------------------------------------------------
Total 1.8 MB/s | 6.1 MB 00:03
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : openssh-5.3p1-112.el6_7.x86_64 1/10
Installing : 1:perl-Error-0.17015-4.el6.noarch 2/10
Installing : libedit-2.11-4.20080712cvs.1.el6.x86_64 3/10
Installing : openssh-clients-5.3p1-112.el6_7.x86_64 4/10
Installing : rsync-3.0.6-12.el6.x86_64 5/10
Installing : perl-Git-1.7.1-3.el6_4.1.noarch 6/10
Installing : git-1.7.1-3.el6_4.1.x86_64 7/10
Updating : openssh-server-5.3p1-112.el6_7.x86_64 8/10
Cleanup : openssh-server-5.3p1-94.el6.x86_64 9/10
Cleanup : openssh-5.3p1-94.el6.x86_64 10/10
Verifying : openssh-clients-5.3p1-112.el6_7.x86_64 1/10
Verifying : perl-Git-1.7.1-3.el6_4.1.noarch 2/10
Verifying : 1:perl-Error-0.17015-4.el6.noarch 3/10
Verifying : rsync-3.0.6-12.el6.x86_64 4/10
Verifying : libedit-2.11-4.20080712cvs.1.el6.x86_64 5/10
Verifying : openssh-5.3p1-112.el6_7.x86_64 6/10
Verifying : git-1.7.1-3.el6_4.1.x86_64 7/10
Verifying : openssh-server-5.3p1-112.el6_7.x86_64 8/10
Verifying : openssh-5.3p1-94.el6.x86_64 9/10
Verifying : openssh-server-5.3p1-94.el6.x86_64 10/10
Installed:
git.x86_64 0:1.7.1-3.el6_4.1
Dependency Installed:
libedit.x86_64 0:2.11-4.20080712cvs.1.el6
openssh-clients.x86_64 0:5.3p1-112.el6_7
perl-Error.noarch 1:0.17015-4.el6
perl-Git.noarch 0:1.7.1-3.el6_4.1
rsync.x86_64 0:3.0.6-12.el6
Dependency Updated:
openssh.x86_64 0:5.3p1-112.el6_7 openssh-server.x86_64 0:5.3p1-112.el6_7
Complete!
安装完成后
1 | $ which git |
OK, 其他版本的Linux大概也就是这样的了