How to set up git SSH keys?

Answered

I've got remote repository on Bitbucket. It seems that my IDE can't see the path to my SSH keys. In my git config I've got following line:

"puttykeyfile = E:\\...\\hg-bitbucket.ppk"

My SSH executable in phpStorm is set to "built-in". When I try to push something to the remote branch I receive information: "10:44    Push failed: Failed with error: Could not read from remote repository."

In my IDE settings in "Bitbucket" section there is button "Add SSH keys" however it doesn't work. There is no action when I click on it. I changed SSH executable into "native" and it's still doesn't work.

What should I do?

 

 

5
10 comments

BitBucket integration is a 3rd party plugin. We unfortunately do not provide integration with BitBucket out of the box.

I haven't also found any information if "puttykeyfile" config setting is correctly read by IDE. So I would suggest testing this with a standard setup (id_rsa.pub and id_rsa files in your user_home\.ssh directory)

0

I don't use any 3rd party plugin only build-in VCS. I click close task with: commit, merge settings checked, then I press ctrl + shift + K (push) and I receive message shown in my first post. So I can't push to remote branch without 3rd party plugin?

I tried to put rsa files into basic ssh directory, but it didn't work. I use pageant to store my passwords, because my private key is encrypted, however it still doesn't work. I also changed GIT settings to Native.

I found a solution here: https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000114504--Solved-Git-SHH-Private-Key-PAssPhrase

However I already done these steps (I'm using Pageant and SSH native) and my PhpStorm still can't push anything.

 

0

Just to be sure, when you perform git push via Terminal, it doesn't ask you for the passphrase, does it?

0

When I checked it in terminal I received extra information that my public key has got invalid format. It works under tortoiseGit and Pageant, however it seems that native git wants another format. All in all it's not IDE issue, so thank you for paying attention.

0

Steps to integrate 'SSH' key in Intellij -
1. Open 'PuTTYgen' application.
2. Click on 'File > Load private key'.
3. Choose your .ppk file from directory.
4. Click on 'Conversions > Export OpenSSH key'.
5. Save the file in 'C:\Users\(your username)\.ssh' folder with 'id_rsa' name.
6. Open Intellij.
7. Click on 'File > Settings'.
8. Expand 'Version Control'.
9. Expand 'Subversion'.
10. Click on 'SSH'.
11. Select 'Private key' radio button.
12. Select the generated file stored in 'C:\Users\(your username)\.ssh' folder.
13. Click on 'Ok' button.

Test configuration: Click 'VCS > Git > Fetch'. If 'Fetch Successful' message displays, your configuration is successful

 

9

Thank you Ahsan Himel you reply perfectly fix the problem

0

Thank you Ahsan Habib Himel you made my day and ended a weeks long search

0

I had this problem and got it to work by configuring in my `~/.ssh/config` which identity private key to use for the intended host. I followed the suggestion in this answer: https://superuser.com/a/232406/226668

1

Scott Hajek's answer worked for me

0

Please sign in to leave a comment.