使用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"
相关推荐
摇滚侠10 小时前
GIT 代码冲突 git pull 和 git pull rebase 的区别,保持提交记录的线性整齐
git
汪海游龙10 小时前
03.25 AI 精选:Wine 11重写内核层提速跑Windows游戏
github
研究点啥好呢11 小时前
3月24日GitHub热门项目推荐|让AI无所不能
人工智能·python·开源·github
Timer@11 小时前
TypeScript + React + GitHub Actions:我是如何打造全自动化 AI 资讯系统的 - 已开源
react.js·typescript·github
badhope11 小时前
Matplotlib实战30例:全类型图表代码库
人工智能·python·plotly·github·matplotlib
badhope11 小时前
最小二乘与最速下降法实战解析
人工智能·机器学习·plotly·github·matplotlib
CoderJia程序员甲11 小时前
GitHub 热榜项目 - 日榜(2026-03-24)
人工智能·ai·大模型·github·ai教程
C++ 老炮儿的技术栈11 小时前
现代 C++(C++11 及以后)的移动语义
linux·c语言·开发语言·c++·github
vistaup1 天前
windows git 更新当前目录下所有的文件(非递归)
windows·git
王码码20351 天前
Flutter for OpenHarmony:Flutter 三方库 algoliasearch 毫秒级云端搜索体验(云原生搜索引擎)
android·前端·git·flutter·搜索引擎·云原生·harmonyos