IntelliJ - 如何使用不同的ssh密钥

Ste*_*lle 6 git rsa github intellij-idea

我有2个github帐户公司一个和个人帐户

我使用cygwin来管理我的ssh密钥并连接到Github

一切正常在IntelliJ中使用公司帐户,因为它使用默认的.ssh/id_rsa键

使用我的个人帐户,Everthing在Cygwin中正常工作,因为我可以使用"ssh-add~/.ssh/ide_rsa_otherkeyfile"命令,然后通过命令行使用所有git命令

但IntelliJ始终默认为"id_rsa"文件,因此我无法连接到我的个人仓库.

IntelliJ有没有办法使用其他rsa密钥?

所有这些RSA和cygwin都高于我的linux命令行体验级别.

注意:我还在.ssh目录中创建了配置文件,以方便多个github帐户

Default GitHub user (corporate account) 
Host github.com HostName
github.com User git IdentityFile/Users/username/.ssh/id_rsa

Client user (personal account)
Host github-client
HostName github.com
User git IdentityFile /Users/username/.ssh/id_rsa_perso
Run Code Online (Sandbox Code Playgroud)

简而言之,它的作用是告诉SSH在连接到服务器github-client时使用客户端密钥,这实际上是github.com.

如果没有人有解决方案,我知道邀请我的公司帐户作为贡献者会更容易,但之后我会在2个单独的电子邮件帐户下提交.

kuk*_*ido 11

从版本控制系统检出项目时,请使用<host-from-ssh-config>:<github-username>/<repository>格式作为VonC提到的.

$ cat ~/.ssh/config
Host github.com-activehacker
    HostName github.com
    User git
    IdentityFile /Users/andrey/.ssh/id_rsa_activehacker
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述


小智 8

使用Git集成:

IntelliJ IDEA支持使用多个ssh密钥的标准方法,通过创建.ssh/config文件.