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

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

问题描述

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

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.

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

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.

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

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?

我发现的大多数例子只是为了与 github 一起使用.

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

推荐答案

如果你使用Git for Windows"

If you use "Git for Windows"

>cd c:Program FilesGitetcssh

在 ssh_config 中添加以下内容:

add to ssh_config following:

AddKeysToAgent yes
IdentityFile ~/.ssh/id_rsa
IdentityFile ~/.ssh/id_rsa_test

ps.您需要 ssh 版本 >= 7.2(发布日期2016-02-28)

ps. you need ssh version >= 7.2 (date of release 2016-02-28)

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

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