使用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"
相关推荐
爱说实话7 小时前
腾讯云Ubuntu远程无法ssh登录
云计算·ssh·腾讯云
午安~婉10 小时前
GitHub Token/ GitHub Stats统计显示图异常
前端·github·vercel·github token
.Hypocritical.10 小时前
Git 入门教程
git
Liekkas Kono11 小时前
Codex(ChatGPT 桌面版)支持SSH连接远程服务器
chatgpt·ssh·swhl
dong_junshuai12 小时前
每天一个开源项目#59 AirLLM:27.6K星,3.72GB显存跑2.8T模型
人工智能·程序员·github
lpfasd12312 小时前
2026年第31周GitHub趋势周报
github
Jul1en_13 小时前
【Claude Code Compact】源码级别的学习上下文压缩
java·前端·学习·github·ai编程
逛逛GitHub14 小时前
Karpathy 刚发了一个帖子,怎么判断一个新模型到底行不行?
github
m4Rk_14 小时前
【论文阅读】Agent 记忆机制(28):MEM1——将记忆压缩融入推理,实现近似恒定上下文的长程智能体
论文阅读·人工智能·学习·开源·github
逛逛GitHub14 小时前
盘点 17 个 7 月份 GitHub 上夯夯夯的开源项目。
github