如何解决这个问题? ssh:连接到主机 github.com 端口 22:连接超时致命

问题描述 投票:0回答:3

每当我尝试跑步时

git pull upstream master -X ours
我收到以下错误:

ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

我几乎遵循了我在网上能找到的几乎所有解决方案,但还没有解决这个问题。有人可以帮忙解决这个问题吗?谢谢

git ubuntu ssh
3个回答
2
投票

如果您在公司环境中,传出 SSH 连接通常会被阻止。或者这可能是GFW 的副作用(尽管香港应该不会受到影响)。

无论如何,第一个测试是检查访问并切换到 HTTPS,看看它是否有效:

  • ping github.com
  • cd /path/to/repo
    git remote set-url origin https://github.com/<me>/<myRepo>

2
投票

对我来说,重新连接 wifi 连接和 VPN 连接解决了问题。


0
投票

我也面临着同样的问题。像往常一样,编码后我总是推送代码。但这一次没有成功。我按照Many tuts解决了这个问题。但当我意识到我的 VPN 已经打开时,就结束了。但在此之前我应用了以下命令:

git 远程 set-url origin https://github.com/username/repo-name

并且成功了。

© www.soinside.com 2019 - 2024. All rights reserved.