使用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"
相关推荐
小弥儿9 小时前
GitHub今日热榜 | 2026-08-26:AI 大脑与知识管理扎堆
人工智能·学习·开源·github
阿里嘎多学长9 小时前
2026-08-24 GitHub 热点项目精选
开发语言·程序员·github·代码托管
其实防守也摸鱼10 小时前
信创是什么:一文读懂信息技术应用创新
人工智能·阿里云·云计算·github·copilot
秃秃秃秃哇11 小时前
fatal: the remote end hung up unexpectedl
github
峰向AI11 小时前
Label Studio:数据标注领域的"瑞士军刀",文本、音频、视频、图片、时序全部拿捏
github
CSDN_RTKLIB12 小时前
多次git add拆解
git
CSDN_RTKLIB12 小时前
git push -u
git
逛逛GitHub13 小时前
把这个国产神器接入你的 Codex 或 Claude Code,图片秒变 3D 模型。
github
chongzhe13 小时前
AgentConnect:多 Agent 协作的开源版 Claude Tag
人工智能·github·源码