.ssh / config文件(windows)(git) [英] .ssh/config file for windows (git)

查看:1614
本文介绍了.ssh / config文件(windows)(git)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找一个关于如何使用多个ssh密钥的解决方案,并且我发现它可以与.ssh目录中的配置文件一起工作,但它不适用于windows。



我的问题是我使用私钥访问git服务器,所以它看起来像这样:
ssh://git@example.com/directory ,当我使用TortoiseGit时它工作正常,因为有可能选择私钥。

但是我想在我的IntelliJ IDEA中使用git rep并且只有使用git本地shell的选项,如果我将名为id_rsa的密钥放入.ssh文件夹中,它也可以使用。现在我想使用多个ssh密钥(所以我的密钥将得到名称id_rsa_test,那么如何在Windows下配置.ssh / config文件,它可以与通常的git服务器一起使用?



我发现的大多数例子只是供github使用。

解决方案

选项 IdentityFile ,您可以在〜/ .ssh / config 文件中使用它,并指定每个主机的密钥文件。 / p>

 主机host_with_key1.net 
IdentityFile〜/ .ssh / id_rsa

主机host_with_key2.net
IdentityFile〜/ .ssh / id_rsa_test

更多信息: http://linux.die.net/man/5/ssh_config



另请参阅 http ://nerderati.com/2011/03/17/simplify-your-life-with-an-ssh-config-file/


I've been looking for a solution on how I can use multiple ssh keys and I figured out, that it will work with a config file in the .ssh directory, but it doesn't work on windows.

My problem is that I'm using a private key to access a git server, so it looks like this: ssh://git@example.com/directory , it works fine when I'm using TortoiseGit, 'cause there is a possibility to choose the private key.

But I want to use the git rep in my IntelliJ IDEA and there is just the option to use the git native shell and it also works, if I put the key, called id_rsa ,into the .ssh folder. Now I want to use multiple ssh keys (so my key will get the name "id_rsa_test", so how do I configure the .ssh/config file under Windows, that it works with a usual git server?

The most examples I found yet are just for the use with github.

解决方案

There is an option IdentityFile which you can use in your ~/.ssh/config file and specify key file for each host.

Host host_with_key1.net
  IdentityFile ~/.ssh/id_rsa

Host host_with_key2.net
  IdentityFile ~/.ssh/id_rsa_test

More info: http://linux.die.net/man/5/ssh_config

Also look at http://nerderati.com/2011/03/17/simplify-your-life-with-an-ssh-config-file/

这篇关于.ssh / config文件(windows)(git)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆