草庐IT

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

Sofia紫菀 2023-06-12 原文

新建远程仓库后,在本地使用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 out

XXXXX MINGW64 /c/XXX/ng-myWYY (dev)
$ git branch -a
* dev
  main
  master
  remotes/origin/main
  remotes/origin/master

XXXXX 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 10054

XXXXX MINGW64 /c/XXX/ng-myWYY (dev)
$ git config --global http.proxy

XXXXX MINGW64 /c/XXX/ng-myWYY (dev)
$ git config --global --unset http.proxy

XXXXX MINGW64 /c/XXX/ng-myWYY (dev)
$ git config --global --unset https.proxy

XXXXX 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 -> dev

XXXXX MINGW64 /c/XXX/ng-myWYY (dev)
$ git branch -a
* dev
  main
  master
  remotes/origin/dev
  remotes/origin/main
  remotes/origin/master


XXXXX 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.       

有关git push报错:fatal: unable to access ‘https://XXX.git/‘: Failed toconnect to github.com port 443的更多相关文章

  1. Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting - 2

    1.错误信息:Errorresponsefromdaemon:Gethttps://registry-1.docker.io/v2/:net/http:requestcanceledwhilewaitingforconnection(Client.Timeoutexceededwhileawaitingheaders)或者:Errorresponsefromdaemon:Gethttps://registry-1.docker.io/v2/:net/http:TLShandshaketimeout2.报错原因:docker使用的镜像网址默认为国外,下载容易超时,需要修改成国内镜像地址(首先阿里

  2. git使用常见问题(提交代码,合并冲突) - 2

    文章目录git常用命令(简介,详细参数往下看)Git提交代码步骤gitpullgitstatusgitaddgitcommitgitpushgit代码冲突合并问题方法一:放弃本地代码方法二:合并代码常用命令以及详细参数gitadd将文件添加到仓库:gitdiff比较文件异同gitlog查看历史记录gitreset代码回滚版本库相关操作远程仓库相关操作分支相关操作创建分支查看分支:gitbranch合并分支:gitmerge删除分支:gitbranch-ddev查看分支合并图:gitlog–graph–pretty=oneline–abbrev-commit撤消某次提交git用户名密码相关配置g

  3. ruby - 从另一个私有(private)方法中使用 self.xxx() 调用私有(private)方法 xxx,导致错误 "private method ` xxx' called” - 2

    我正在尝试获得良好的Ruby编码风格。为防止意外调用具有相同名称的局部变量,我总是在适当的地方使用self.。但是现在我偶然发现了这个:classMyClass上面的代码导致错误privatemethodsanitize_namecalled但是当删除self.并仅使用sanitize_name时,它会起作用。这是为什么? 最佳答案 发生这种情况是因为无法使用显式接收器调用私有(private)方法,并且说self.sanitize_name是显式指定应该接收sanitize_name的对象(self),而不是依赖于隐式接收器(也是

  4. ruby - Dropbox 类似 git 的服务——没有 rsync 和 inotify - 2

    关于如何使用git设置类似Dropbox的服务,您有什么建议吗?您认为git是解决此问题的合适工具吗?我在考虑使用git+rush解决方案,你觉得怎么样? 最佳答案 检查这个开源项目:https://github.com/hbons/SparkleShare来自项目的自述文件:Howdoesitwork?SparkleSharecreatesaspecialfolderonyourcomputer.Youcanaddremotelyhostedfolders(or"projects")tothisfolder.Theseprojec

  5. ruby - 混帐 & ruby : How can I unset the GIT_DIR variable from inside a ruby script? - 2

    我编写了一个非常简单的“部署”脚本,作为我的裸git存储库中的post-updateHook运行。变量如下livedomain=~/mydomain.comstagingdomain=~/stage.mydomain.comgitrepolocation=~/git.mydomain.com/thisrepo.git(bare)core=~/git.mydomain.com/thisrepo.gitcore==addedremoteintoeachlive&stagegitslive和stage都初始化了gitrepos(非裸),我已经将我的裸仓库作为远程添加到它们中的每一个(名为co

  6. ruby - 让 bundler 使用 http : instead of git:? - 2

    我正在安装gitlabhq,并且在Gemfile中有对某些资源的“git://...”的引用。但是,我在公司防火墙后面,所以我必须使用http://。我可以手动编辑Gemfile,但我想知道是否有另一种方法告诉bundler使用http://作为git存储库? 最佳答案 您可以通过运行gitconfig--globalurl."https://".insteadOfgit://或通过将以下内容添加到~/.gitconfig:[url"https://"]insteadOf=git://

  7. ruby-on-rails - 安装 active admin 时 activeadmin.git (at master) is not yet checked out 错误 - 2

    Activeadmingem已添加到我的rails项目中,但每次我尝试安装railsgactive_admin:install时,我都会收到类似的错误git://github.com/activeadmin/activeadmin.git(atmaster)isnotyetcheckedout.Runbundleinstallfirst.我肯定在运行“railsgactive_admin:install”之前运行了bundle。运行“bundleshow”后,我看到我已将“*activeadmin(1.0.0.pre3f916d6)”添加到我的项目中,但不断收到此错误消息。我的gem文

  8. ruby - 警告 : PATH set to RVM ruby but GEM_HOME and/or GEM_PATH not set, 请参阅 : https://github. com/wayneeseguin/rvm/issues/3212 - 2

    我每次打开终端时都会收到这个错误:警告:PATH设置为RVMruby​​但未设置GEM_HOME和/或GEM_PATH,请参阅:https://github.com/wayneeseguin/rvm/issues/3212这是在我最近安装zsh(oh-my-zsh)后开始发生的我不知道如何设置GEM_HOME和/或GEM_PATH的路径。 最佳答案 我也面临同样的问题,更改.zshrc中的以下行,exportPATH="/usr/local/heroku/bin:.........."到exportPATH="$PATH:/usr/

  9. ruby - 如何获得带有 SSL 客户端证书的 HTTPS 请求以与 Ruby EventMachine 一起使用? - 2

    我正在尝试使用RubyEventMachine访问使用SSL证书身份验证的HTTPSWeb服务,但我没有让它工作。我编写了以下简单代码块来对其进行端到端测试:require'rubygems'require'em-http'EventMachine.rundourl='https://foobar.com/'ssl_opts={:private_key_file=>'/tmp/private.key',:cert_chain_file=>'/tmp/ca.pem',:verify_peer=>false}http=EventMachine::HttpRequest.new(url).g

  10. ruby - Net::HTTP 对 HTTPS 请求的响应极其缓慢 - 2

    出于某种原因,在我的开发机器上,我对通过Net::HTTP执行的HTTPS请求的响应非常非常慢。我试过RestClient和HTTParty,它们都有同样的问题。它似乎是凭空冒出来的。我已毫无问题地提出这些请求数百次,但今天它们的速度慢得令人难以忍受。pry(main)>putsTime.now;HTTParty.get('https://api.easypost.com/v2/addresses');putsTime.now;2015-04-2908:07:08-05002015-04-2908:09:39-0500如您所见,响应耗时2.5分钟。不仅仅是这个EasyPostAPIUR

随机推荐