转载请注明出处:http://www.houxiurong.com/?post=27
Mac默认是安装了ssh工具软件的。
先用mac的 终端工具生成 id_rsa 和id_rsa.pub 秘钥,生成方式如下:
看看存不存在.ssh,如果存在的话,掠过下一步;不存在的请看下一步
现在你可以看到,在自己的目录下,有一个.ssh目录,说明成功了
xxx-MacBook-Pro:.ssh xxx$ cd .ssh
xxx-MacBook-Pro:.ssh xxx$ ls
config id_rsa id_rsa.pub known_hosts
xxx-MacBook-Pro:.ssh xxx$ pwd
/Users/xxx/.ssh
打开github,找到账户里面添加SSH,把id_rsa.pub内容复制到key里面(注意使用cat id_rsa.pub查看,以防有空格)。
使用下面的命令测试
当你看到这些内容放入时候,直接yes
看到这个内容放入时候,说明就成功了。
Host *
ForwardAgent yes
PasswordAuthentication yes
StrictHostKeyChecking no
HashKnownHosts yes
Compression yes
ServerAliveInterval 60
保存退出,重新登录即可。。。