PyCharm 无法连接到网关后面的远程设备 (java.net.UnknownHostException)
PyCharm can't connect to a remote behind a gateway (java.net.UnknownHostException)
我尝试连接到网关后面的远程机器进行调试和部署。
通过将~/.ssh/config
设置为
Host target_machine_name
ProxyCommand ssh gateway_machine -W %h:%p
我可以从命令行通过 ssh 连接到那台机器(使用:ssh target_machine_name
)
但是,当我尝试 "configure remote python interpreter" 时,我遇到了以下错误:
java.net.UnknownHostException: target_machine_name
知道如何以 java.net 支持的方式转发通信吗?
我设法通过用显式 ssh 隧道命令替换隧道来解决问题,如 this answer
ssh -N -L localhost:2260:target_machine_name:22 gateway_machine
并将 ssh 定向到端口为 2260 的本地主机
我尝试连接到网关后面的远程机器进行调试和部署。
通过将~/.ssh/config
设置为
Host target_machine_name
ProxyCommand ssh gateway_machine -W %h:%p
我可以从命令行通过 ssh 连接到那台机器(使用:ssh target_machine_name
)
但是,当我尝试 "configure remote python interpreter" 时,我遇到了以下错误:
java.net.UnknownHostException: target_machine_name
知道如何以 java.net 支持的方式转发通信吗?
我设法通过用显式 ssh 隧道命令替换隧道来解决问题,如 this answer
ssh -N -L localhost:2260:target_machine_name:22 gateway_machine
并将 ssh 定向到端口为 2260 的本地主机