使用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 小时前
手机SSH直连电脑运行iflow终极安全配置
windows·安全·ssh
不爱学英文的码字机器6 小时前
Git误操作急救手册大纲
git
A懿轩A7 小时前
【2026 最新】Mac 电脑配置指南:Homebrew 安装换源 + Git 环境配置(保姆级教程)
git
切糕师学AI9 小时前
Visual Studio Git 使用指南
git·elasticsearch·visual studio
徐小夕9 小时前
借助AI,1周,0后端成本,我开源了一款Office预览SDK
前端·vue.js·github
蜜汁小强10 小时前
Git Worktree:在不打断当前开发的情况下紧急修复生产问题
git
CoderJia程序员甲10 小时前
GitHub 热榜项目 - 日榜(2026-03-18)
ai·大模型·llm·github·ai教程
逛逛GitHub11 小时前
硅谷大佬把自己 Claude Code 武器库给开源了,1 周就 2 万点赞。
github
梦醒过后说珍重11 小时前
【踩坑记录】局域网使用 mDNS 免 IP 登录服务器,却被代理 Fake-IP 劫持的排查过程
ssh
星浩AI11 小时前
清华团队开源!我给孩子制作了 AI 互动课堂,手把手教你给孩子做一个
人工智能·后端·github