2016-08-12 68 views
1

我们在Xen上运行的Windows虚拟机上使用Eclipse IDE。另一方面,我们正在使用Gitolite来管理Git存储库。它们使用Gitolite的镜像功能镜像到多台服务器上。Windows上的Eclipse IDE的系统范围SSH配置文件

我打算做的是在主服务器关闭的情况下将用户透明地切换到备份服务器。

为此,我的想法是在SSH设置中创建一个系统范围的主机别名。在Linux上,例如,我会使用/etc/ssh/ssh_config文件中包含的条目:

Host scms.box 
    Hostname master-server 

如果说主服务器宕机,那么我可以代替主机名:

Host scms.box 
    Hostname backup-server 

Eclipse的IDE是阅读从~/.ssh/config的SSH设置,但这是用户特定的(如在Linux上)。
我想知道在Windows上是否会有相当于/etc/ssh/ssh_config

回答

1

我想知道在Windows上是否会有相当于/etc/ssh/ssh_config

正如在 “Git SSH client for Windows and path for .ssh/config file

<installPath>\Git\etc\ssh\ssh_config 

提到如果set GIT_SHH<installPath>\Git\usr\bin\ssh.exe(和启动Eclipse),然后Eclipse应当同时使用SSH全局配置。

+0

这需要安装额外的软件。 eGit/eclipse没有内部功能来处理它吗? –

+0

@fboule未安装。只需解压缩:https://github.com/git-for-windows/git/releases/download/v2.9.3.windows.1/PortableGit-2.9.3-64-bit.7z.exe – VonC

+0

好的,但重点是这是另一个维护软件(用于更新错误修复,安全修复程序等)。当你只有一次安装时,这是可以接受的,但当你正在谈论约100个用户的工作环境时,这是可以接受的。 –

1

简短回答:它没有在JGit中实现。它只支持“用户”配置文件。

长答案:我一直在寻找EGit/JGit源代码。 JGit正在读取SSH配置并将该对象作为参数传递以创建SSH会话。但是,JGit仅支持用户配置文件。

片段的jgit/org.eclipse.jgit/src/org/eclipse/jgit/transport/OpenSshConfig.java

public static OpenSshConfig get(FS fs) { 
    File home = fs.userHome(); 
    if (home == null) 
     home = new File(".").getAbsoluteFile(); //$NON-NLS-1$ 

    final File config = new File(new File(home, ".ssh"), Constants.CONFIG); //$NON-NLS-1$ 
    final OpenSshConfig osc = new OpenSshConfig(home, config); 
    osc.refresh(); 
    return osc; 
}