首页 > 上网技巧 > 电脑小技巧 > 配置SSH访问GitHub

配置SSH访问GitHub

时间:2019-07-31 15:58 作者:QQ地带 我要评论

检查已存在的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 su

标签: Github ssh
顶一下
(0)
0%
踩一下
(0)
0%

Google提供的广告