一、Generating a new SSH key

  1. Open Git Bash.

  2. Paste the text below, substituting in your GitHub email address.

1
ssh-keygen -t rsa -b 4096 -C "your_email@example.com" 

// 输入这句话,连按三个回车,直接跳过下面的步骤

This creates a new ssh key, using the provided email as a label.

1
Generating public/private rsa key pair.
  1. When you’re prompted to “Enter a file in which to save the key,” press Enter. This accepts the default file location.
1
Enter a file in which to save the key (/c/Users/you/.ssh/id_rsa):[Press enter]
  1. At the prompt, type a secure passphrase. For more information, see “Working with SSH key passphrases”.
1
2
Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]

二、安装完成之后,输入命令 ll ~/.ssh 查看是否安装成功,出现 id_rsa(锁) 和 id_rsa.pub(钥匙) 成功

三、出现锁🔒之后,我们输入命令cat ~/.ssh/id_rsa.pub查看内容并上传github

四、创建完成之后我们可以测试一下

如果之前已经存在,输入命令rm ~./ssh/known_hosts删除之前的连接

输入命令测试连接
1
ssh -T git@github.com

yse