配置SSH访问GitHub
检查已存在的Key
$ ls -al ~/.ssh
生成一个新的SSH Key
-
生成
$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
-
输入文件路径
//直接回车即可,可重命名文件 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]
添加SSH key到ssh-agent
-
确保ssh-agent可用
$ eval "$(ssh-agent -s)"
-
添加SSH key到ssh-agent
$ ssh-add ~/.ssh/id_rsa
将SSH key添加到GitHub账号
-
复制key
$ pbcopy < ~/.ssh/id_rsa.pub
-
Setting/SSH and GPG keys/New SSH key
测试SSH连接
-
测试
ssh -T git@github.com
-
确认指纹
The authenticity of host 'github.com (192.30.252.1)' 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)?
-
大功告成
Hi username! You've successfully authenticated, but GitHub does not provide shell access.
- 原文作者:yrq110
- 原文链接:http://yrq110.me/post/tool/github-ssh-config/
- 版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议进行许可,非商业转载请注明出处(作者,原文链接),商业转载请联系作者获得授权。