【问题标题】:Solving the a client side SSH connection error解决客户端 SSH 连接错误
【发布时间】:2022-11-14 16:22:01
【问题描述】:

基本上我不能再连接到 SSH 服务器了。每当我尝试连接时,我都会收到以下错误:

ssh: connect to host HOSTNAME port 22: Connection refused

请注意,我可以从另一台机器连接。因此,问题似乎是客户端。此外,我也无法拉/推到通过 ssh 克隆的 git 存储库。同样,拉动时出现以下错误:

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

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

好像我以某种方式破坏了我的 SSH 安装/配置文件。我已经重新安装了 SSH,但这并没有解决问题。有任何想法吗?

【问题讨论】:

  • 当你运行ssh git@github.com时,它会返回你的github用户名吗?
  • 我得到同样的错误:ssh:连接到主机 github.com 端口 22:连接被拒绝
  • 如果您在公司环境中,请向您的 IT 部门投诉。否则,请尝试使用 Cloudflare WARP。
  • 我在 eduroam 上。通过将 github 主机添加到 ssh 配置文件,我现在可以从 github 中提取。但是我仍然无法通过 SSH 连接到我的私人服务器,即使使用 -p 443 参数也是如此。

标签: linux github ssh


【解决方案1】:

请注意,您永远不会直接“连接”到 github.com(没有交互式 shell)

mentioned here,“连接被拒绝”表示

  • github.com 的 IP 地址无效(在 /etc/hosts 或您的解析器中手动输入)
  • 通往 github.com 的防火墙会阻止 ssh 流量(例如本地防火墙或公司防火墙)

同一网络上的另一台机器(您成功的地方)也是如此吗?
检查另一台机器的 SSH 配置文件是否没有使用 ssh.gthub.com port 443(而不是默认的 github.com:22,通常在公司环境中被阻止)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-05-17
    • 2023-01-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多