我有三台机器
local (windows)
serverA (linux) with username as userA
serverB (linux) with username as userB
我想使用Windows的TortoiseHg将
serverB
中的hg存储库克隆到本地计算机。机器serverB
仅可通过ssh
进行serverA
ed编辑。因此,在winScp / PuTTY中,我使用隧道选项通过serverB
连接到serverA
。但是我该如何在TortoiseHg中做到这一点?显然我不能使用
hg clone ssh://userB@serverB://<path to repo>
。但是有没有一种方法可以使用多个ssh命令。我尝试了以下方法,但没有成功:$cat ~/.ssh/config
host serverB.example.com serverB
ProxyCommand /usr/bin/ssh serverA.example.com /usr/bin/nc %h %p
最佳答案
您有以下选择:
ssh
上的serverA
端口,在.ssh/config
中添加以下内容:host serverBtunnel
LocalForward 2222 serverB.example.com:22
然后使用以下命令启动隧道(在
serverA
上):ssh -N serverBtunnel
之后,您可以使用以下命令克隆存储库(从Windows框中):
hg clone ssh://userB@serverA:2222//<path to repo>
Putty
创建隧道(有关更多详细信息,请参见here)。基本上:serverB
:serverA
的 session (将定义隧道):hg clone ssh://userB@localhost:2222//<path to repo>
关于ssh - 从通过另一台服务器连接的服务器克隆存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34568988/