使用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"
相关推荐
juelianhuayao1 小时前
Git错误提交后如何快速删除本次commit
git
chen<>1 小时前
Git原理与应用
大数据·git·elasticsearch·svn
行百里er1 小时前
代码跑得慢?让Spring的StopWatch告诉你真相!
java·后端·github
小兔崽子去哪了2 小时前
Git 专题
git
金米kk2 小时前
git pull时报错Your local changes to the following files would…的解决办法
git
超级罗伯特2 小时前
git一次性完成仓库下载及所有分支获取
git·git仓库拉取
BUTCHER52 小时前
Git 基础命令
git
M malloc2 小时前
当你有两个git账号时,此时你gitpush冲突后如何解决push问题
git
cuijiecheng20184 小时前
Linux控制台下git使用图形化界面进行文件对比
linux·运维·git
程序员雄杰5 小时前
腾讯云轻量应用服务器mac中ssh免密登录到服务器
macos·ssh·腾讯云