Push failed: Unable to access: OpenSSL SSL_read: Connection was reset, errno 10054 git push提交代码推送失败

一个报错信息

OpenSSL SSL_read: Connection was reset, errno 10054

一开始查说解除ssl验证,这个命令

git config --global http.sslVerify "false"

方法,直接调到第三个错误

没用,依旧报错,然后又查出说可能改过本机的host文件清dns缓存

//mac
sudo killall -HUP mDNSResponder
sudo dscacheutil -flushcache

//win
ipconfig /flushdns

不行,扒出来一个先设置再取消proxy代理

git config --global http.sslVerify "false"

第二个报错

Push Failed: Unable to access ‘https://github.com/nuo2000/headFirst-javascript.git/’: Failed to connect to github.com port 443: Timed out

//设置代理
git config --global http.proxy http://127.0.0.1:1080
git config --global https.proxy http://127.0.0.1:1080

第三个错误

Push Failed: Unable to access ‘https://github.com/nuo2000/headFirst-javascript.git/’: Failed to connect to 127.0.0.1 port 1080: Connection refused

//取消代理
git config --global --unset http.proxy
git config --global --unset https.proxy

第四个错误,原因:自2021年8月13日起,github不再支持使用密码push的方式

Push Failed
Remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
Authentication Failed for ‘https://github.com/nuo2000/headFirst-javascript.git/’

请改用个人访问令牌使用,解决方案:两种
一、 使用SSH
二、使用Personal access tokenPersonal access token

因为公司生成的有ssh,我又不懂这些,我使用的是官方资料第二种获取token

1.验证您的电子邮件地址(如果尚未验证)。

2.在任何页面的右上角,单击

在这里插入图片描述

3.您的个人资料照片,然后单击 Settings(设置)。
在左侧边栏中,单击 Developer settings。

在这里插入图片描述

4.在左侧边栏中,单击 Personal access tokens(个人访问令牌)。

在这里插入图片描述

5.单击 Generate new token(生成新令牌)。

在这里插入图片描述

6.给令牌一个描述性名称

在这里插入图片描述

7.要使令牌过期,请选择 Expiration(到期)下拉菜单,然后单击认值或使用日历选择器。

在这里插入图片描述

8.选择要授予此令牌的作用域或权限。 要使用令牌从命令行访问仓库,请选择 repo(仓库)。

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-RayUWE7b-1635587186330)(https://docs.github.com/assets/images/help/settings/token_scopes.gif#pic_center)]


在这里插入图片描述

9.单击 Generate token(生成令牌)。

在这里插入图片描述


警告: 像对待密码一样对待您的令牌,确保其机密性。 使用 API 时,应将令牌用作环境变量,而不是将其硬编码到程序中。

10.要使用令牌向实施 SAML SSO 的组织验证,请授权该令牌用于 SAML 单点登录组织。

下面开始使用令牌,进入正题了奥

在这里插入图片描述

复制项目的https地址

在这里插入图片描述


把复制的仓库地址前面的https://删掉再粘贴进去

git push https://你的token@你的仓库链接,我这里是我的仓库链接你要改成你的
git push https://你的token@github.com/sober-orange/study.git

会弹出来一个login的登录,这里的密码是把复制的token作为密码粘贴进去

在这里插入图片描述

在这里插入图片描述


好了,推送成功。感谢各位网友。
必应搜索引擎问题也挺好使的

在这里插入图片描述

我根本不懂这些,稀里糊涂的,搞了一天,记录一下,下次再忘拿出来用

在这里插入图片描述

相关文章

本篇内容主要讲解“gitee如何上传代码”,感兴趣的朋友不妨来...
这篇“从gitee上下的代码如何用”文章的知识点大部分人都不太...
这篇文章主要介绍“gitee如何下载仓库里的项目”,在日常操作...
本篇内容主要讲解“怎么在Gitee上更新代码”,感兴趣的朋友不...
本文小编为大家详细介绍“怎么将工程托管到gitee”,内容详细...
这篇文章主要介绍了gitee中图片大小如何调整的相关知识,内容...