Connecting GIT & SSH With IntelliJ IDEA

Written by

After a recent re-format of my macbook hardrive I was having trouble with managing my project in IntelliJ IDEA using git. This is actually an old problem I have stumbled across before when using Gitolite, hence this blog post.

I use SSH heavily nowadays and have multiple SSH keys, when trying to connect to a git repository via IntelliJ I kept getting prompted for a password and not a pass phrase which is obviously wrong, hence whats the point in using ssh! I then noticed that IntelliJ’s popup dialogue was asking for the wrong ssh key, I needed IntelliJ to use a different key to access my git repository.

So, two things I had to make sure I had correctly setup are:

1) Ensure that the path to the git executable was correctly defined.


2) Create an SSH config file to state which ssh key to use for the designated server hosting your git repository.

(and specific for some Gitolite situations:

After that you should be good to go, try and run an update or commit to your Git repos from within IntelliJ and you should find it will no longer prompt you for your password and select the correct ssh key.

P.S. Oh and have you noticed in IntelliJ IDEA’s preferences you can enter your GitHub login details and pull directly from your GitHub repository ;) Sweeeeet!!! Read more about it here.