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.在任何页面的右上角,单击Push failed: Unable to access: OpenSSL SSL_read: Connection was reset, errno 10054 git push提交代码推送失败
3.您的个人资料照片,然后单击 Settings(设置)。
在左侧边栏中,单击 Developer settings。
Push failed: Unable to access: OpenSSL SSL_read: Connection was reset, errno 10054 git push提交代码推送失败
4.在左侧边栏中,单击 Personal access tokens(个人访问令牌)。
Push failed: Unable to access: OpenSSL SSL_read: Connection was reset, errno 10054 git push提交代码推送失败
5.单击 Generate new token(生成新令牌)。
Push failed: Unable to access: OpenSSL SSL_read: Connection was reset, errno 10054 git push提交代码推送失败
6.给令牌一个描述性名称。
Push failed: Unable to access: OpenSSL SSL_read: Connection was reset, errno 10054 git push提交代码推送失败
7.要使令牌过期,请选择 Expiration(到期)下拉菜单,然后单击默认值或使用日历选择器。
Push failed: Unable to access: OpenSSL SSL_read: Connection was reset, errno 10054 git push提交代码推送失败

8.选择要授予此令牌的作用域或权限。 要使用令牌从命令行访问仓库,请选择 repo(仓库)。
Push failed: Unable to access: OpenSSL SSL_read: Connection was reset, errno 10054 git push提交代码推送失败
Push failed: Unable to access: OpenSSL SSL_read: Connection was reset, errno 10054 git push提交代码推送失败

9.单击 Generate token(生成令牌)。
Push failed: Unable to access: OpenSSL SSL_read: Connection was reset, errno 10054 git push提交代码推送失败
警告: 像对待密码一样对待您的令牌,确保其机密性。 使用 API 时,应将令牌用作环境变量,而不是将其硬编码到程序中。

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

下面开始使用令牌,进入正题了奥
Push failed: Unable to access: OpenSSL SSL_read: Connection was reset, errno 10054 git push提交代码推送失败

复制项目的https地址
Push failed: Unable to access: OpenSSL SSL_read: Connection was reset, errno 10054 git push提交代码推送失败
把复制的仓库地址前面的https://删掉再粘贴进去

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

会弹出来一个login的登录,这里的密码是把复制的token作为密码粘贴进去
Push failed: Unable to access: OpenSSL SSL_read: Connection was reset, errno 10054 git push提交代码推送失败

Push failed: Unable to access: OpenSSL SSL_read: Connection was reset, errno 10054 git push提交代码推送失败
好了,推送成功。感谢各位网友。
必应搜索引擎问题也挺好使的
Push failed: Unable to access: OpenSSL SSL_read: Connection was reset, errno 10054 git push提交代码推送失败

我根本不懂这些,稀里糊涂的,搞了一天,记录一下,下次再忘拿出来用
Push failed: Unable to access: OpenSSL SSL_read: Connection was reset, errno 10054 git push提交代码推送失败

上一篇:【友晶科技Terasic】 解读Nios II IP 的 Reset Vector 和 Exception Vector


下一篇:Git回滚代码到某个commit