ssh 查看 安装
2016-07-19 18:05
211 查看
1. 检查SSH keys是否存在
输入下面的命令,如果有文件id_rsa.pub 或 id_dsa.pub,则直接进入步骤3将SSH key添加到GitHub中,否则进入第二步生成SSH key
ls -al ~/.ssh
# Lists the files in your .ssh directory, if they exist
2. 生成新的ssh key
第一步:生成public/private rsa key pair
在命令行中输入ssh-keygen -t rsa -C "your_email@example.com"
默认会在相应路径下(/your_home_path)生成id_rsa和id_rsa.pub两个文件,如下面代码所示
ssh-keygen -t rsa -C "your_email@example.com"
# Creates a new ssh key using the provided email
Generating public/private rsa key pair.
Enter file in which to save the key (/your_home_path/.ssh/id_rsa):
第二步:输入passphrase(本步骤可以跳过)
设置passphrase后,进行版本控制时,每次与GitHub通信都会要求输入passphrase,以避免某些“失误”
Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]
sample result:
Your identification has been saved in /your_home_path/.ssh/id_rsa.
Your public key has been saved in /your_home_path/.ssh/id_rsa.pub.
The key fingerprint is:
#01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your_email@example.com
第三步:将新生成的key添加到ssh-agent中:<珐攻粹纪诔慌达苇惮俩br />
# start the ssh-agent in the background
eval "$(ssh-agent -s)"
Agent pid 59566
ssh-add ~/.ssh/id_rsa
3. 将ssh key添加到GitHub中
用自己喜欢的文本编辑器打开id_rsa.pub文件,里面的信息即为SSH key,将这些信息复制到GitHub的Add SSH key页面即可
输入下面的命令,如果有文件id_rsa.pub 或 id_dsa.pub,则直接进入步骤3将SSH key添加到GitHub中,否则进入第二步生成SSH key
ls -al ~/.ssh
# Lists the files in your .ssh directory, if they exist
2. 生成新的ssh key
第一步:生成public/private rsa key pair
在命令行中输入ssh-keygen -t rsa -C "your_email@example.com"
默认会在相应路径下(/your_home_path)生成id_rsa和id_rsa.pub两个文件,如下面代码所示
ssh-keygen -t rsa -C "your_email@example.com"
# Creates a new ssh key using the provided email
Generating public/private rsa key pair.
Enter file in which to save the key (/your_home_path/.ssh/id_rsa):
第二步:输入passphrase(本步骤可以跳过)
设置passphrase后,进行版本控制时,每次与GitHub通信都会要求输入passphrase,以避免某些“失误”
Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]
sample result:
Your identification has been saved in /your_home_path/.ssh/id_rsa.
Your public key has been saved in /your_home_path/.ssh/id_rsa.pub.
The key fingerprint is:
#01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your_email@example.com
第三步:将新生成的key添加到ssh-agent中:<珐攻粹纪诔慌达苇惮俩br />
# start the ssh-agent in the background
eval "$(ssh-agent -s)"
Agent pid 59566
ssh-add ~/.ssh/id_rsa
3. 将ssh key添加到GitHub中
用自己喜欢的文本编辑器打开id_rsa.pub文件,里面的信息即为SSH key,将这些信息复制到GitHub的Add SSH key页面即可
相关文章推荐
- static说明
- 《杂文》 --- 平台选择
- OWA页面改密码提示成功,但登录不上
- B树
- 仿googleMVP设计模式示例demo,结合rxjava,retrofit2.0
- AndroidStudio Debug调试按钮
- @Aspect注解形式实现AOP实例
- 在Centos中yum安装和卸载软件的使用方法
- TCP/IP协议 学习之总结 (一)
- 常用正则表达式
- Vijos P1459 车展 treap求任意区间中位数
- 网络通信之 字节序转换原理与网络字节序、大端和小端模式
- 优化UITableViewCell高度计算的那些事
- linux grep 详解
- iOS 的传值处理(顺逆)
- display: none;、visibility: hidden、opacity=0区别总结
- Milk(sort+结构体)
- VC控件DateTimePicker使用方法
- Spring MVC + MongoDB + Maven搭建项目开发环境
- css中的calc()函数