SSH到GitHub

记录如何SSH链接到GitHub。

1.Open Terminal.

2.查看是否存在SSH keys

1
2
cd ~/.ssh
cat id_rsa.pub

3.如果存在,复制 ssh-rsa 到 example@email.com 的内容

1
ssh-rsa AAAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxfAj6vXZesuTgn11QbIygytzOUzwo+PQXrtliUgi1FbEHoKdT9jbGXiUpQ== example@email.com

4.产生新的SSH Keys
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

输入保存的rsa名字,默认产生id_rsa和id_rsa.pub文件
Enter a file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]

输入密码,可以为空
Enter passphrase (empty for no passphrase): [Type a passphrase]

密码再次确认
Enter same passphrase again: [Type passphrase again]

5.回到第二步测试

6.GitHub设置
https://github.com/settings/keys中添加复制内容

参考: