提示:本项目是在 Github 上测试的,其他 git 网站类似
-
cd ~/.ssh
命令行进入 ~/.ssh 路径下 -
ls
检查有没有配置好的 SSH Key
查看是否有已生成的 SSH Key.png
- 如果 key 存在,会有 id_rsa 和 id_rsa.pub可以直接将 id_rsa.pub 里面的 key 复制到远程 GitHub上即可;
- 当然,如果 key 不存在或者你的 id_rsa 不是 github 配置的,还需再次创建下
-
ssh -T git@github.com
检查是否和github连接上,链接成功的话会出现“Hi xxx! You've successfully authenticated, but GitHub does not provide shell access.”字段; -
ssh-keygen -t rsa -C panzhangbao@126.com
生成 SSH Key
id_rsa_github
新建你本地的 SSH Key 文件名
生成本地 SSH Key.png
-
open id_rsa_github.pub
打开本地的 SSH Key 文件,并复制这个 Key
打开本地的 SSH Key 文件.png
-
打开你的 Github ,点击头像,进入 settings
进入 settings.png
-
点击 SSH and GPG keys --> New SSH Key ,新建 SSH Key 就好了
新建 SSH Key.png
![](https://img.haomeiwen.com/i2029885/04d3e11325c1e6ae.png)
搞定!
网友评论