标签:
最近配置了github的ssh key,翻找了大量资料后发现github官方就有相关的教程……在此翻译一下官方教程以加深印象
原文链接:https://help.github.com/categories/ssh/
ls -al ~/.ssh来查看是否有ssh key存在
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"生成一个新的ssh key,使用填入的邮箱地址作为ssh key的标签,并生成RSA密钥对
Enter a file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]按下回车,表示把ssh key放在默认地址
Enter passphrase (empty for no passphrase): [Type a passphrase] Enter same passphrase again: [Type passphrase again]
eval "$(ssh-agent -s)"该指令返回进程id则表示已经启用ssh-agent
ssh-add ~/.ssh/id_rsa
clip < ~/.ssh/id_rsa.pub如果不成功就用编辑器打开该文件直接复制内容
ssh -T git@github.com尝试去用ssh连接github,你可能会看到一些警告信息:
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)?输入yes不管他就好
Hi username! You've successfully authenticated, but GitHub does not provide shell access则表示ssh连接成功了
git remote -v
git remote set-url origin https://github.com/USERNAME/OTHERREPOSITORY.gitorigin为仓库名,后面接的是ssh仓库地址:
git remote -v
Github 之 SSH key的创建于配置(Windows)
标签:
原文地址:http://blog.csdn.net/superxlcr/article/details/51354257