IntelliJ - How to use a different ssh key

I have 2 github accounts. One and one personal company.

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

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

Evertime works great in Cygwin using my personal account, since I can use the command "ssh-add ~ / .ssh / ide_rsa_otherkeyfile" and then use all the git commands through the command line

But IntelliJ always uses id_rsa by default, so I can’t connect to my personal repo.

Is there a way to use IntelliJ another rsa key?

All of these RSA and cygwin are above my Linux command line level.

Note: I also created a configuration file in the .ssh directory to facilitate the operation of several 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, this means that SSH uses the client key when connecting to the github-client server, which is actually github.com.

If someone has no solution, I know that it would be easier to invite my corporate account as a contributor, but then I will perform actions under two separate email accounts.

+6
source share
2 answers

When checking your project from the version control system, use the format <host-from-ssh-config>:<github-username>/<repository> as VonC .

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

enter image description here

+9
source

From Using Git Integration :

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

+8
source

Source: https://habr.com/ru/post/890309/


All Articles