1、执行命令:git push -u origin main 时,报错:fatal: unable to access ‘https://github.com/shuijingwan/refactoring.git/’: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version。如图1

PS E:\wwwroot\refactoring> git push -u origin main
fatal: unable to access 'https://github.com/shuijingwan/refactoring.git/': error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version
2、参考:Work for me on Windows: update git to latest version (2.16) and remove old version ( 1.9)。如图2

3、查看 Git 的版本:1.9.5。如图3

PS E:\wwwroot\refactoring> git --version
git version 1.9.5.msysgit.1
4、打开:https://git-scm.com/download/win ,下载安装 64-bit Git for Windows Setup。
5、重启电脑后,查看版本,仍然为 1.9.5,查看环境变量:C:\Program Files\Git\cmd,已经自动修改为 2.3 版本的 path。删除环境变量:C:\Program Files (x86)\Git\bin、C:\Program Files (x86)\Git\libexec\git-core。如图4

PS C:\WINDOWS\system32> git --version
git version 2.36.1.windows.1
6、或者直接卸载 Git 1.9 版本。卸载时环境变量会被自动删除。如图5

7、再次执行命令:git push -u origin main 时,不再报同样的错误。原因应该在于网络不稳定所导致。
PS E:\wwwroot\refactoring> git push -u origin main
fatal: unable to access 'https://github.com/shuijingwan/refactoring.git/': OpenSSL SSL_read: Connection was reset, errno 10054
8、再次执行,弹出 Connect to GitHub 。输入 Personal access token。如图6

PS E:\wwwroot\refactoring> git push -u origin main
fatal: unable to access 'https://github.com/shuijingwan/refactoring.git/': Failed to connect to github.com port 443 after 21030 ms: Timed out
PS E:\wwwroot\refactoring> git push -u origin main
fatal: unable to access 'https://github.com/shuijingwan/refactoring.git/': OpenSSL SSL_read: Connection was reset, errno 10054
PS E:\wwwroot\refactoring> git push -u origin main
fatal: 鍝嶅簲鐘舵€佷唬鐮佷笉鎸囩ず鎴愬姛: 401 (Unauthorized)銆?Username for 'https://github.com': shuijingwan
Password for 'https://shuijingwan@github.com':
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.
fatal: Authentication failed for 'https://github.com/shuijingwan/refactoring.git/'
PS E:\wwwroot\refactoring>
9、提示输入用户名与密码。授权失败。remote:对密码身份验证的支持已于 2021 年 8 月 13 日移除。请改用个人访问令牌。如图7

PS E:\wwwroot\refactoring> git push -u origin main
fatal: unable to access 'https://github.com/shuijingwan/refactoring.git/': Failed to connect to github.com port 443 after 21030 ms: Timed out
PS E:\wwwroot\refactoring> git push -u origin main
fatal: unable to access 'https://github.com/shuijingwan/refactoring.git/': OpenSSL SSL_read: Connection was reset, errno 10054
PS E:\wwwroot\refactoring> git push -u origin main
fatal: 鍝嶅簲鐘舵€佷唬鐮佷笉鎸囩ず鎴愬姛: 401 (Unauthorized)銆?Username for 'https://github.com': shuijingwan
Password for 'https://shuijingwan@github.com':
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.
fatal: Authentication failed for 'https://github.com/shuijingwan/refactoring.git/'
PS E:\wwwroot\refactoring>
10、参考:https://www.shuijingwanwq.com/2021/12/20/5525/ 。测试连接,打开 Git Bash 输入:ssh -T git@github.com ,测试通过。如图8

$ ssh -T git@github.com
The authenticity of host 'github.com (20.205.243.166)' can't be established.
ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
Hi shuijingwan! You've successfully authenticated, but GitHub does not provide shell access.
11、生成新的 Personal access token,删除 .git 目录,重新提交与推送。推送成功。如图9

Administrator@PC MINGW64 /e/wwwroot/refactoring (main)
$ git init
Initialized empty Git repository in E:/wwwroot/refactoring/.git/
Administrator@PC MINGW64 /e/wwwroot/refactoring (master)
$ git add README.md
Administrator@PC MINGW64 /e/wwwroot/refactoring (master)
$ git commit -m "first commit"
[master (root-commit) ba74a0c] first commit
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 README.md
Administrator@PC MINGW64 /e/wwwroot/refactoring (master)
$ git branch -M main
Administrator@PC MINGW64 /e/wwwroot/refactoring (main)
$ git remote add origin https://xxx@github.com/shuijingwan/refactoring.git
Administrator@PC MINGW64 /e/wwwroot/refactoring (main)
$ git push -u origin main
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Writing objects: 100% (3/3), 239 bytes | 119.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
To https://github.com/shuijingwan/refactoring.git
* [new branch] main -> main
branch 'main' set up to track 'origin/main'.
Administrator@PC MINGW64 /e/wwwroot/refactoring (main)
$
需要长期技术维护或远程问题排查?
我是拥有 15+ 年经验的 PHP / Go 后端工程师,长期关注已有系统维护、Bug 修复、性能优化、服务器排查、WordPress 网站维护和小功能迭代。
如果你的项目遇到以下情况,可以先从一次小问题排查开始合作:
- ✅ PHP / Laravel / Yii2 老项目无人维护
- ✅ Go / Gin 后端接口需要排查或优化
- ✅ WordPress 网站访问慢、报错或插件冲突
- ✅ Nginx / MySQL / Redis / Linux 服务器异常
- ✅ CDN / Cloudflare / DNS / HTTPS 配置问题
- ✅ 需要长期远程技术支持或兼职维护
更多介绍请查看:关于我 & 合作
微信:13980074657
邮箱:shuijingwanwq@gmail.com
Telegram:@shuijingwan
GitHub:https://github.com/shuijingwan
