Answer the question
In order to leave comments, you need to log in
How to use different ssh keys in PhpStorm?
Hello!
I'm dumb, but I can't figure it out. I have a cygwin terminal on a windows machine - babun. It has ssh keys, there is also git. I have several SSH keys, it's more convenient for me - different keys for different servers.
I set up git in PhpStorm, now I want to use key authorization. In some incomprehensible way, Phpstorm itself picks up the key from the .ssh/ directory and it is the one that is stock - id_rsa, but I need to use another key to connect to gitlab - x_id_rsa is acceptable. I read it on the Internet, added a config file with the following contents to the .ssh/ directory in the baboon (I screwed up the MB in it, because I vaguely understand how it should work exactly):
host gitlab
HostName gitlab.com
IdentityFile ~/.ssh/x_id_rsa
User [email protected]
The two things you can do to fix this are:
1) copy the public and private key-pair you'd like PhpStorm to use to id_rsa.pub and id_rsa respectively
or
2) Rename the "Host" entry in ~/.ssh/config to actually match the domain in the project's .git/config file
Host gitlab.com
should include exactly the host to which Git connects (not just gitlab or AnyName, but gitlab.com) IdentityFile ~/.ssh/x_id_rsa
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question