使用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"
相关推荐
悟道子HD5 分钟前
计算机网络端口记忆指南
计算机网络·http·https·ssh·ftp·端口号·smtp
向上_5035829134 分钟前
解决git提交冲突
git
学习使我健康39 分钟前
Git Submodule 深度避坑指南
git
Hical_W1 小时前
C++ 也能优雅写 Web?5 分钟用 Hical 搭建 REST API
开发语言·c++·github
CoderJia程序员甲2 小时前
GitHub 热榜项目 - 日榜(2026-04-20)
ai·大模型·llm·github·ai教程
Java后端的Ai之路2 小时前
SSH配置与GitHub项目拉取操作指南
elasticsearch·ssh·github·公钥
纪伊路上盛名在2 小时前
如何跨设备访问我们VSCode中GitHub Copilot 的聊天记录?
vscode·github·copilot·工作流
minxihou2 小时前
Windows 11 OpenSSH Server 完整排错指南(微软账号场景)
windows·microsoft·ssh·openssh·troubleshooting·windowswsl2
Mapleay2 小时前
git notes
git
阿汤哥的程序之路2 小时前
ProxyJump
ssh