IntelliJ - How to use a different ssh key

Viewed 6805

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.

2 Answers
Related