先下载https://code.google.com/p/git-osx-installer/
安装 控制台输入git --version查看是否安装
生成SSH key
ssh-keygen -t rsa -C "your_email"
回车会出现
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/qifeng/.ssh/id_rsa): shinit_test
Enter passphrase (empty for no passphrase):
如果设置密码就输入,不设置就回车
Your identification has been saved in shinit_test.
Your public key has been saved in shinit_test.pub.
生成完成,运行命令的当前目录,本机生成在家目录下
然后添加私钥
ssh-add shinit_test
登陆github添加分钥即shinit_test.pub文件中的字符串
测试连接
ssh git@github.com
The authenticity of host 'github.com (192.30.252.129)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.252.129' (RSA) to the list of known hosts.
Connection to github.com closed.