Github添加SSH Key
2015-12-01 23:26
357 查看
笔者操作系统是ubuntu
运行下面的命令创建SSH Key
然后根据提示输入github密码
生成的id_rsa文件是私有密钥
id_rsa.pub是公开的密钥
查看公钥的内容
输出结果
复制上述的内容
使用私钥和github进行认证
结果显示
成功!!!
如果出现下图问题
继续即可
使用SSH Key访问github
输入命令
以后pull push都不用输入密码了
运行下面的命令创建SSH Key
ssh-keygen -t rsa -C "byhook@163.com"邮箱为github登陆邮箱
然后根据提示输入github密码
Generating public/private rsa key pair. Enter file in which to save the key (/home/byhook/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/byhook/.ssh/id_rsa. Your public key has been saved in /home/byhook/.ssh/id_rsa.pub. The key fingerprint is: f5:9a:53:d3:97:d1:61:11:81:f6:9a:53:e1:c2:ab:62 byhook@163.com The key's randomart image is: +--[ RSA 2048]----+ | .*+| | o..o| | . o o.o| | . . + +o| | S + B..| | + * . | | + . . | | E o | | . . | +-----------------+
生成的id_rsa文件是私有密钥
id_rsa.pub是公开的密钥
查看公钥的内容
cat ~/.ssh/id_rsa.pub
输出结果
ssh-rsa 公钥内容 byhook@163.com
复制上述的内容
使用私钥和github进行认证
ssh -T git@github.com
结果显示
The authenticity of host 'github.com (192.30.252.131)' 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 Warning: Permanently added 'github.com,192.30.252.131' (RSA) to the list of known hosts. Hi byhook! You've successfully authenticated, but GitHub does not provide shell access.
成功!!!
如果出现下图问题
Warning: Permanently added the RSA host key for IP address '192.30.252.131' to the list of known hosts. Agent admitted failure to sign using the key. Permission denied (publickey).输入命令
ssh-add输入密码
继续即可
使用SSH Key访问github
输入命令
git remote set-url origin git@github.com:byhook/IPCSample.gitOK
以后pull push都不用输入密码了
相关文章推荐
- C 语言易忘点笔记(二)
- TOTP算法 基于时间的一次性密码
- TOTP算法 基于时间的一次性密码
- leetcode Divide Two Integers python
- C 语言易忘点笔记(一)
- SpringMVC由于级联导致查询结果重复
- java一些基础
- SpringMVC+Spring+Mybatis快速入门(一)配置详解
- LAMP 1.4 PHP编译安装问题解决
- C++继承总结
- SpringMVC_post乱码
- php
- SpringMVC_参数绑定1
- 理解C语言——从小菜到大神的晋级之路(1)——引言:C语言的前世今生
- java如何快速实现深copy
- springmvc源码心得之handler及handlerAdapter设计
- Java查看动态代理生成的代码
- servlet自动刷新页面(比赛文字直播)
- TensorFlow的代码框架
- 如何愉快地写代码