为Github账户设置SSH key

原理

1.产生SSH key

1.0先检查是否已经生成过了

$ cd ~/.ssh
# Checks to see if there is a directory named ".ssh" in your user directory

1.1使用ssh-keygen产生新的key

$ 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 (/home/you/.ssh/id_rsa):

1.2使用默认的文件名直接enter, 按提示输入密码(如果不提供密码,SSH将无密码连接,如果private key泄露可能会有安全问题)

Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]

1.3密匙产生成功

Your identification has been saved in /home/you/.ssh/id_rsa.
Your public key has been saved in /home/you/.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

2.上传public key到Github账户

2.1登录github

2.2点击右上方的Accounting settings图标

2.3选择 SSH key

2.4点击 Add SSH key

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值