[英]mercurial hg clone a repo from a server connected through another server
I have three machines 我有三台机器
local (windows)
serverA (linux) with username as userA
serverB (linux) with username as userB
I want to clone a hg repository in serverB
to my local machine using TortoiseHg for windows. 我想使用Windows的TortoiseHg将serverB
的hg存储serverB
到本地计算机。 The machine serverB
can be ssh
ed only though serverA
. 该机serverB
可以ssh
版虽然只有serverA
。 So in winScp/PuTTY I use tunneling option to connect to serverB
through serverA
. 因此,在WINSCP /腻子我用隧道选项连接到serverB
通过serverA
。 But how do I do it in TortoiseHg? 但是我该如何在TortoiseHg中执行呢?
Obviously I cannot use hg clone ssh://userB@serverB://<path to repo>
. 显然我不能使用hg clone ssh://userB@serverB://<path to repo>
。 But is there a way to use multiple ssh commands`. 但是有没有一种方法可以使用多个ssh命令。 I tried the below approach and it did not work: 我尝试了以下方法,但没有成功:
$cat ~/.ssh/config
host serverB.example.com serverB
ProxyCommand /usr/bin/ssh serverA.example.com /usr/bin/nc %h %p
You have the following options: 您有以下选择:
You can forward the ssh
port on serverA
, in your .ssh/config
add something like: 您可以转发serverA
上的ssh
端口,在.ssh/config
添加类似以下内容:
host serverBtunnel LocalForward 2222 serverB.example.com:22
Then start the tunnel (on serverA
) with: 然后使用以下命令启动隧道(在serverA
):
ssh -N serverBtunnel
After this you can clone the repo (from your windows box) using: 之后,您可以使用以下命令克隆存储库(从Windows框中):
hg clone ssh://userB@serverA:2222//<path to repo>
Create the tunnel directly from Putty
(see here for more details). 直接从Putty
创建隧道(有关更多详细信息,请参见此处 )。 Basically: 基本上:
serverB
: 您将定义隧道并将其添加到serverB
: serverA
(that will have the tunnel defined): 然后创建到serverA
的会话(将定义隧道): This way, on your windows box (assuming that the above session is started), you will be able to clone the repo, using: 这样,在Windows框上(假设上述会话已启动),您将能够使用以下命令克隆存储库:
hg clone ssh://userB@localhost:2222//<path to repo>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.