标签:
使用SSH Key的好处是不用每次提交代码都要填写github的用户名和密码。
一、生成SSH Key
1.填写邮箱:
ssh-keygen -t rsa -C "注册邮箱"
然后.ssh目录下有两个文件,id_rsa是私钥 id_rsa.pub是公钥
2.按提示输入密码:
3.启动ssh-agent
ssh-agent -s
4.添加将生成的key添加到id_rsa文件里,(提示输入密码时,输入刚才的密码)
ssh-add ~/.ssh/id_rsa
5.获取key内容
start ~/.ssh/id_rsa.pub
然后就看到类似这样一段东西,这就是key的内容
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAJ4eqoXYVMHI6fIJHIIdWP6....HRtq/DLdV84kRFL6oI3x4QRJA5 549344672@qq.com
6.打开github,https://github.com/settings/ssh
7.测试下
ssh -T git@github.com
提示成功:
C:\Users\Administrator> ssh -T git@github.com Warning: Permanently added ‘github.com,192.30.252.130‘ (RSA) to the list of know n hosts. Hi nanfei9330! You‘ve successfully authenticated, but GitHub does not provide sh ell access.
标签:
原文地址:http://www.cnblogs.com/tinyphp/p/5015909.html