第一个报错信息
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(仓库)。
9.单击 Generate token(生成令牌)。
警告: 像对待密码一样对待您的令牌,确保其机密性。 使用 API 时,应将令牌用作环境变量,而不是将其硬编码到程序中。
10.要使用令牌向实施 SAML SSO 的组织验证,请授权该令牌用于 SAML 单点登录组织。
复制项目的https地址
把复制的仓库地址前面的https://删掉再粘贴进去
git push https://你的token@你的仓库链接,我这里是我的仓库链接你要改成你的
git push https://你的token@github.com/sober-orange/study.git