使用git+ssh访问github,避免下载资源失败

一、创建github账户之后,记住注册邮箱和账户名

我的邮箱:yuanyan23@mails.ucas.ac.cn

账户名:thekingofjumpshoot

下边的相关位置需要用自己的邮箱和用户名替代

二、输入本地生成秘钥和公钥命令,并且生成公私钥对

ssh-keygen -t rsa -C  "yuanyan23@mails.ucas.ac.cn"

输入命令后连摁三次enter即可生成秘钥

找到如图中的公钥位置,将其复制粘贴的github上的对应位置

如图是公钥的样子,复制出来待会使用

三、公钥粘贴的位置

四、测试是否连通

sh -T git@github.com

若出现The authenticity of host '[ssh.github.com]:443 ([20.205.243.160]:443)' can't be established.
ECDSA key fingerprint is  SHA256:XXX.
Are you sure you want to continue connecting (yes/no/[fingerprint])?
     输入 yes

再输入一遍 ssh -T git@github.com
提示 Hi user.name! You've successfully authenticated, but GitHub does not provide shell access.

效果如图,即连接成功

五、配置过之后,下一次只需要输入如下代码即可连接

git config --global user.email  "yuanyan23@mails.ucas.ac.cn"
git config --global user.name  "thekingofjumpshoot"
相关推荐
1379003408 小时前
Git 设置代理
git
Web极客码10 小时前
WordPress“更新失败,响应不是有效的JSON响应”问题的修复
json·github·wordpress
xiaodunmeng15 小时前
sourcetree gitee 详细使用
git
是懒羊羊吖~15 小时前
图床 PicGo+GitHub+Typora的下载安装与使用
经验分享·笔记·github·typora·picgo
LostSpeed16 小时前
git,gitea - tool - creat Gitea Empty Rep Dir
git·gitea
前端郭德纲18 小时前
vscode默认终端怎么设置成git bash
git·vscode·bash
全息数据20 小时前
vscode通过ssh连接服务器实现免密登录+删除
服务器·vscode·ssh
近听水无声4771 天前
git 学习(基于Ubuntu和gitee)
git
逛逛GitHub1 天前
刚刚!Open AI 宣布开源?
github
不是伍壹2 天前
【R语言】GitHub Copilot安装-待解决
github·copilot