一、mac下git的安装
1、点击进入网址:http://git-scm.com找到安装文件和使用信息
2、下载git安装,双击下载的.dmg
3、双击.pkg文件包的图案,按提示安装
4、打开终端输入指令 sudo mv /usr/bin/git /usr/bin/git-system
5、继续输入 source /etc/profile
安装完毕,查看一下安装路径,输入终端指令:which git 会得到路径/usr/local/bin/git
二、配置ssh连接
1、$ ssh-keygen -t rsa -C < your email> (后面的是git上注册的邮件哦)
2、
$ ssh-keygen -t rsa -C < your email>
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/angela/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/angela/.ssh/id_rsa.
Your public key has been saved in /Users/angela/.ssh/id_rsa.pub.
The key fingerprint is:
0e:70:c0:67:4b:08:15:b3:37:d9:b9:9a < your email>
The key's randomart image is:
+--[ RSA 2048]----+
| .+=o |
| o++o |
| o+=.. |
| +.. . |
| o=.. |
| E+o |
+-----------------+
3、.登录github设置一下账户里的ssh key,即:settings > SSH keys > add SSH keys,将第2步生成的id_rsa.pub里面的内容粘过来 4、在终端里测试一下是否连接成功 $ ssh git@github.com
The authenticity of host 'github.com (192.30.xxx .xxx)' can't be established.
RSA key fingerprint is 16:27:ac::63:1b:56:4d:eb:df:a68.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.xxx.xxx' (RSA) to the list of known hosts.
PTY allocation request failed on channel 0
Hi ! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.
完成啦,现在github和本地的git就可以顺利的连接啦,本地的代码就可以上传git仓库啦。
三、将安装了的git添加到PATH环境变量中
1、export PATH="$PATH:路径:$PATH"
2、查看添加后的路径
echo $PATH
四、从github上下载资源
git clone git://github.com/phonegap/phonegap