9

I have 2 github accounts A company one and a personal one

I use cygwin to manage my ssh keys and connect to Github

Everything works fine In IntelliJ when using the corporate account since it uses the the default .ssh/id_rsa key

Everthing works fine in Cygwin using my Personal Account since I can use the the "ssh-add ~/.ssh/ide_rsa_otherkeyfile" command and then use all git commands via command line

But IntelliJ always default to the "id_rsa" file so I can not connect to my personal repo.

Is there a way for IntelliJ to use the other rsa key?

All this RSA and cygwin is way above my linux command line experience level.

Note: I also created the config file in .ssh directory to facilitate multiple github accounts

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

In short what this does is tells SSH to use the client key when connecting to the server github-client, which is really github.com.

If no one has a solution I am aware that it would be easier to invite my corporate account as a contributor but then I woul have commits under 2 seperate email account.

  • If IntelliJ does respect the config file, using an address like `github-client:aGitRepoName` should be enough for IntelliJ to use the other ssh key. – VonC Jun 11 '11 at 23:23

2 Answers2

14

When checking out your project from Version Control System, use <host-from-ssh-config>:<github-username>/<repository> format as VonC mentioned.

$ cat ~/.ssh/config
Host github.com-activehacker
    HostName github.com
    User git
    IdentityFile /Users/andrey/.ssh/id_rsa_activehacker

enter image description here

Community
  • 1
  • 1
kukido
  • 10,431
  • 1
  • 45
  • 52
8

From Using Git integration:

IntelliJ IDEA supports the standard method of using multiple ssh keys, by means of creating .ssh/config file.

David206
  • 85
  • 1
  • 5