使用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"
相关推荐
青 春 记 忆4 小时前
零基础入门Python11|Git实战:为任务管理器建立版本历史
开发语言·git·vscode·python·python3.11
牢姐与蒯6 小时前
Linux基础开发工具之版本控制器git
git
面包狗AI4S8 小时前
GitHub AI4S 项目观察(2026-08-07—2026-08-13)
人工智能·github
华科大胡子8 小时前
GitHub Actions自动化运维实战技术文章大纲
github
云原生指北8 小时前
Docker Sandboxes 工作区怎么接:Direct、Clone 和它们的边界
git·docker·agent
fthux8 小时前
装闭 RenoPit 源码解析(14):Demo模式、健康检查与Docker部署
人工智能·ai·开源·github·open source·renopit
TunerT_TQ9 小时前
Meta React 源码静态评测:从 4540 个源文件看 React Compiler 的工程化演进
meta·开源·github
峰向AI10 小时前
再也不怕换工具失忆了:它给 AI 编程助手装上"长期记忆"
github
菠萝猫yena10 小时前
【git】git 命令常用组合
大数据·git·elasticsearch
tokenKe11 小时前
AirLLM:一张 4GB 显卡,把 70B 模型“流“起来 |SSP Github Daily
github