自定义 SSH 配置不工作
Custom SSH Config Not Working
我一直在尝试让 ssh 使用端口 443 连接到 Github,我决定在 ~/.ssh/config
使用自定义 ssh 配置文件。创建文件并设置适当的文件权限后,我尝试再次连接,连接在端口 22 上仍然超时。我知道这是因为端口 22 被我的 ISP 阻止了(出于某种奇怪的原因)。
$ cd ~/.ssh
$ touch config
$ chown $USER config
$ chmod 644 config
然后在配置文件中添加:
Host pagodabox.io
HostName git.pagodabox.io
Port 443
Host github.com
HostName ssh.github.com
Port 443
然后我尝试从我的 iTerm 应用程序调用它。
$ ssh -T git@ssh.github.com
我收到错误:
ssh: connect to host ssh.github.com port 22: Operation timed out fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
但是,如果我这样做
$ ssh -T -p 443 git@ssh.github.com
我得到了想要的响应。
Hi [Username]! You've successfully authenticated, but GitHub does not provide shell access.
我正在使用 oh-my-zsh FWIW。为什么会这样?我也重新启动了 mac。文件似乎仍未被识别
您写道:
Host github.com
HostName ssh.github.com
Port 443
但没用过:
ssh -T git@ssh.github.com
你需要
ssh -T git@github.com
使用您定义的 github.com
主机。
我一直在尝试让 ssh 使用端口 443 连接到 Github,我决定在 ~/.ssh/config
使用自定义 ssh 配置文件。创建文件并设置适当的文件权限后,我尝试再次连接,连接在端口 22 上仍然超时。我知道这是因为端口 22 被我的 ISP 阻止了(出于某种奇怪的原因)。
$ cd ~/.ssh
$ touch config
$ chown $USER config
$ chmod 644 config
然后在配置文件中添加:
Host pagodabox.io
HostName git.pagodabox.io
Port 443
Host github.com
HostName ssh.github.com
Port 443
然后我尝试从我的 iTerm 应用程序调用它。
$ ssh -T git@ssh.github.com
我收到错误:
ssh: connect to host ssh.github.com port 22: Operation timed out fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
但是,如果我这样做
$ ssh -T -p 443 git@ssh.github.com
我得到了想要的响应。
Hi [Username]! You've successfully authenticated, but GitHub does not provide shell access.
我正在使用 oh-my-zsh FWIW。为什么会这样?我也重新启动了 mac。文件似乎仍未被识别
您写道:
Host github.com
HostName ssh.github.com
Port 443
但没用过:
ssh -T git@ssh.github.com
你需要
ssh -T git@github.com
使用您定义的 github.com
主机。