Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ssh mercurial hg从通过另一台服务器连接的服务器克隆repo_Ssh_Mercurial_Tortoisehg_Hgrc - Fatal编程技术网

Ssh mercurial hg从通过另一台服务器连接的服务器克隆repo

Ssh mercurial hg从通过另一台服务器连接的服务器克隆repo,ssh,mercurial,tortoisehg,hgrc,Ssh,Mercurial,Tortoisehg,Hgrc,我有三台机器 local (windows) serverA (linux) with username as userA serverB (linux) with username as userB 我想使用TortoiseHg for windows将serverB中的hg存储库克隆到我的本地计算机。机器serverB只能通过serverA进行sshed。因此,在winScp/PuTTY中,我使用隧道选项通过serverA连接到serverB。但是我怎么用乌龟来做呢 显然,我不能使用hg克

我有三台机器

local (windows)
serverA (linux) with username as userA
serverB (linux) with username as userB
我想使用TortoiseHg for windows将
serverB
中的hg存储库克隆到我的本地计算机。机器
serverB
只能通过
serverA
进行
ssh
ed。因此,在winScp/PuTTY中,我使用隧道选项通过
serverA
连接到
serverB
。但是我怎么用乌龟来做呢

显然,我不能使用
hg克隆ssh://userB@服务器B://
。但是有没有一种方法可以使用多个ssh命令呢。我尝试了以下方法,但无效:

$cat~/.ssh/config

host serverB.example.com serverB
    ProxyCommand /usr/bin/ssh serverA.example.com /usr/bin/nc %h %p

您有以下选项:

  • 您可以在
    .ssh/config
    中转发
    serverA
    上的
    ssh
    端口,添加如下内容:

    host serverBtunnel
       LocalForward    2222 serverB.example.com:22
    
    然后使用以下命令启动隧道(在服务器A上):

    在此之后,您可以使用以下方法(从windows框)克隆回购:


  • 你说的“不起作用”是什么意思?您是否也尝试了代理命令的
    -w
    方式?我的本地计算机windows。错误的所有者或对
    ~/.ssh/config
    的权限。我需要设置此文件的权限吗
    .ssh
    目录上的权限应该是
    700
    ,对于
    config
    您应该使用
    640
    。我认为我添加的putty替代方案更简单,您不再需要登录
    serverA
    。但是在第一个选项中,要在
    serverA
    上启动该隧道,您将使用
    ssh-NuserA@serverBtunnel
    UserA@serverBtunnel? 难道不是吗userB@serverBtunnel?
    ssh -N serverBtunnel
    
    hg clone ssh://userB@serverA:2222//<path to repo>
    
    hg clone ssh://userB@localhost:2222//<path to repo>