测试SSH服务

在Windows 11系统中,若要测试SSH服务是否正常运行,可以通过执行特定的命令来实现。

  1. 打开终端或命令行窗口。
  2. 输入ssh -T git@github.com
  3. 如果正常输出以下信息:
    “Hi username! You’ve successfully authenticated, but GitHub does not provide shell access.” 其中username是你的GitHub用户名。

相关问题解决

确认是否能访问 github.com:22
telnet github.com 22

安装 telnet
用管理员运行 Windows PowerShell 输入以下命令:
Enable-WindowsOptionalFeature -Online -FeatureName TelnetClient -All

测试 ssh
ssh -vT git@github.com
得到以下信息:
OpenSSH_for_Windows_9.5p1, LibreSSL 3.8.2
debug1: Connecting to github.com [127.0.0.1] port 22.
debug1: connect to address 127.0.0.1 port 22: Connection refused
debug1: Connecting to github.com [127.0.0.1] port 22.
debug1: connect to address 127.0.0.1 port 22: Connection refused
ssh: connect to host github.com port 22: Connection refused

经过研究发现:
这个问题其实就是DNS解析被污染了,有2种可能:
DNS解析被运营商劫持了
使用了科学上网工具(我的问题)