一、在github上创建一个存储库库
1.start a project
2.输入存储库名称,输入对这个库的描述,选择公开的,单击create repository
二、Git Bash
1.输入$ ssh-keygen -t rsa -C “你注册github时的邮箱地址”
ssh-keygen后面有空格
-t后面有空格
rsa后面有空格
引号内需要改成你在注册GitHub的时候绑定的邮箱账号。之后会有一些简单的让你确认的操作,之后让你会提示操作路径、密码等等,一般情况下就直接按回车一路过就可以
2.打开id_rsa.pub,复制里面的全部内容
3.打开我们的github,鼠标移到头像的地方,选择settings
4.创建新key,粘贴全部内容,这样我们就将本地库与github库用ssh key连接起来了
5.输入 ssh -T git@github.com (注意不是输入自己的邮箱哦)
The authenticity of host ‘github.com (xxx.xxx.xxx.xxx)’ can’t be established.
RSA key fingerprint is SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxx.
Are you sure you want to continue connecting (yes/no)?
输入yes即可,如果你设了密码的话会提示输入密码吧,如果和我一样没有设密码就会出现以下提示You’ve successfully authenticated, but GitHub does not provide shell access这样就成功了<