【问题标题】:fatal: unable to connect to github.com: github.com[0: 140.82.121.3]: errno=Operation timed out致命:无法连接到 github.com:github.com[0: 140.82.121.3]: errno=操作超时
【发布时间】:2023-01-27 04:20:01
【问题描述】:

我尝试推送我的项目,它在终端中显示了这个(我使用 MacOS): 致命:无法连接到 github.com: github.com[0: 140.82.121.3]: errno=操作超时

我尝试克隆一个项目,它向我展示了这一点,然后我尝试将一个项目推送到我的个人 GitHub 中,它再次展示了它。在尝试克隆该项目之前,它运行良好。我不知道为什么会这样。

joanskenderi@joans-mbp Course Goals App % git push origin master
fatal: unable to connect to github.com:
github.com[0: 140.82.121.3]: errno=Operation timed out

joanskenderi@joans-mbp Course Goals App % git remote -v
origin  git://github.com/joanskenderi/Course-Goals-App.git (fetch)
origin  git://github.com/joanskenderi/Course-Goals-App.git (push)
joanskenderi@joans-mbp Course Goals App %   

【问题讨论】:

  • 您可以编辑您的问题以包含一个输出为git remote -v 的代码块吗?
  • 我想我做到了。 @bk2204

标签: git github push clone


【解决方案1】:

这里的问题是您在端口 9418 上使用未经身份验证的 Git 协议(可以通过 git:// 看到)。 GitHub turned that off sometime back 因为它是未加密的,几乎任何人都可以篡改。

即使在 GitHub 上支持它,您也永远无法使用它进行推送,因为无法进行身份验证。

您需要将远程 URL 更改为 HTTPS 或 SSH,如下所示:

$ git remote set-url origin https://github.com/joanskenderi/Course-Goals-App.git
# or
$ git remote set-url origin ssh://github.com/joanskenderi/Course-Goals-App.git

最好使用您已为其设置凭据(个人访问令牌或 SSH 密钥)的那个。

【讨论】:

    【解决方案2】:
    $ git remote set-url origin https://github.com/joanskenderi/Course-Goals-App.git
    # or
    $ git remote set-url origin ssh://github.com/joanskenderi/Course-Goals-App.git
    

    这解决了我的问题

    感谢 bk2204

    【讨论】:

      猜你喜欢
      • 2022-07-03
      • 2019-02-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-05
      • 2014-10-16
      相关资源
      最近更新 更多