git push报错:fatal: unable to access ‘https://XXX.git/‘: Failed toconnect to github.com port 443

news/2024/11/22 4:44:26/

新建远程仓库后,在本地使用ng new 创建了一个angular项目,然后分别用使用一下命令推送到远程新建的仓库:
git init
git add .
git commit -m "init project"
git remote add origin "远程仓库http url"
git push origin master

时报错:fatal: unable to access 'https://github.com/SifiaZiwan/ng-myWYY.git/': Failed to connect to github.com port 443 after 21106 ms: Timed out

网上找了取消代理设置的方法:

git config --global http.proxy
git config --global https.proxy

没有解决问题。
后来找到解决办法:https://blog.csdn.net/weixin_45698935/article/details/106599630
 

我的解决过程:

1.  在C:\Windows\System32\drivers\etc 中使用记事本打开hosts文件
注释了 github 的IP地址和域名的映射,
# Github Start
#192.30.253.118    gist.github.com
#192.30.255.112    github.com
#192.30.255.110    www.github.com
# Github End

2. 输入一下git命令, 问题完美解决!

XXXXX MINGW64 /c/XXX/ng-myWYY (main)
$ git checkout -b dev
Switched to a new branch 'dev'XXXXX MINGW64 /c/XXX/ng-myWYY (dev)
$ git push origin dev
fatal: unable to access 'https://github.com/SifiaZiwan/ng-myWYY.git/': Failed to 
connect to github.com port 443 after 21106 ms: Timed outXXXXX MINGW64 /c/XXX/ng-myWYY (dev)
$ git branch -a
* devmainmasterremotes/origin/mainremotes/origin/masterXXXXX MINGW64 /c/XXX/ng-myWYY (dev)
$ git push origin dev
fatal: unable to access 'https://github.com/XXX/ng-myWYY.git/': OpenSSL SSL_read: Connection was reset, errno 10054XXXXX MINGW64 /c/XXX/ng-myWYY (dev)
$ git config --global http.proxyXXXXX MINGW64 /c/XXX/ng-myWYY (dev)
$ git config --global --unset http.proxyXXXXX MINGW64 /c/XXX/ng-myWYY (dev)
$ git config --global --unset https.proxyXXXXX MINGW64 /c/XXX/ng-myWYY (dev)
$ git push origin dev
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 8 threads
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 379 bytes | 379.00 KiB/s, done.
Total 4 (delta 3), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (3/3), completed with 3 local objects.
remote: 
remote: Create a pull request for 'dev' on GitHub by visiting:
remote:      https://github.com/XXX/ng-myWYY/pull/new/dev
remote:
To https://github.com/XXX/ng-myWYY.git* [new branch]      dev -> devXXXXX MINGW64 /c/XXX/ng-myWYY (dev)
$ git branch -a
* devmainmasterremotes/origin/devremotes/origin/mainremotes/origin/masterXXXXX MINGW64 /c/XXX/ng-myWYY (dev)
$ git checkout main
Switched to branch 'main'
Your branch and 'origin/main' have diverged,
and have 2 and 3 different commits each, respectively.(use "git pull" to merge the remote branch into yours)XXXXX MINGW64 /c/XXX/ng-myWYY (main)
$ git push origin main
To https://github.com/XXX/ng-myWYY.git! [rejected]        main -> main (non-fast-forward)
error: failed to push some refs to 'https://github.com/XXX/ng-myWYY.git'  
hint: Updates were rejected because the tip of your current branch is behind     
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.       


http://www.ppmy.cn/news/751214.html

相关文章

解决git下载报错:fatal: unable to access ‘https://github.com/.../.git/‘:

解决git下载报错:fatal: unable to access ‘https://github.com/…/.git/’:… 1、在git中执行git config --global --unset http.proxy和git config --global --unset https.proxy git config --global --unset http.proxy git config --global --unset https.p…

github push 代码出现fatal: Authentication failed for ‘https://github.com/xxx/xxx.git/‘

fatal: Authentication failed for ‘https://github.com/xxx/xxx.git/’: 问题描述 想从服务器上push代码到github,遇见fatal: Authentication failed for 的问题,弄了很久终于解决。 我是第一次使用github上传代码,按照以下两…

解决报错:fatal: Authentication failed for ‘https://github.com/*/*.git/‘

目录 问题 解决 步骤一、 步骤二、 步骤三、 ​步骤四、 ​步骤五、 步骤六、 问题 今天创建一个 github 新仓库,首次上传本地代码时,遇到了一个报错。但是,之前这样操作肯定是没有问题的,毕竟我可以保证用户名和密码都是…

第三章:L2JMobius学习 – 使用eclipse2023创建java工程

在前两个章节中,我们已经安装了mariadb数据库和jdk,本章节我们安装eclipse2023。eclipse作为老牌的java开发工具,真的是不错的。官方下载地址为: https://www.eclipse.org/downloads/download.php?file/technology/epp/download…

1762_gcc编译c语言makefile自动生成工具的Perl实现

全部学习汇总: GreyZhang/g_makefile: Learn makefile from all kinds of tutorials on the web. Happy hacking and lets find an common way so we may dont need to touch makefile code any more! (github.com) 前阵子实现了一个CodeWarrior嵌入式开发环境的自动…

怎样关闭笔记本触控板

FnF8组合键,笔者笔记本是联想的,可通过此法关闭触控板,如遇到个别笔记本电脑通过此方法不能关闭触摸板。另外个别笔记本也提供了关闭触摸板的快捷键,详细信息需要提供具体型号核实。 禁用触控板 打开控制面板,双击打开“鼠标”选…

关闭笔记本自带鼠标触摸键

亲试,此方法确实好用 1 首先在笔记本电脑桌面的“计算机(我的电脑)”上右键鼠标,然后选择打开“属性”,如下图所示。 怎么禁用笔记本键盘 关闭笔记本自带键盘方法 2 打开系统属性后,点击进入上角的【设备管…

测试用例是什么?怎么写?不会测试用例的看过来,

前言 今天笔者想和大家来聊聊测试用例,这篇文章主要是想要写给测试小伙伴们的,因为我发现还是有很多小伙伴在遇到写测试用例的时候无从下手,我就想和大家简单的聊聊,这篇文章主要是针对功能测试的哟。 一、什么是测试用例&#…