进入ssh目录
cd ~/.ssh
如果有,可以删掉;如果没有,会提示No such file or directory
创建
ssh-keygen -t rsa -C "你的邮箱地址"
会提示选择存储位置,直接回车即可
Enter file in which to save the key (/Users/hansion/.ssh/id_rsa):
然后会提示你创建了一个目录
提示设置ssh的密码,输入两次,并且输入的时候不会显示
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
然后会提示存储位置等信息
Your identification has been saved in /Users/hansion/.ssh/id_rsa.
Your public key has been saved in /Users/hansion/.ssh/id_rsa.pub.
打开ssh文件夹
open ~/.ssh
用xcode等工具打开id_rsa.pub,将里面的全部内容复制,添加到Github等网站上即可
网友评论