Android studio git using private key

Ok, finally got it working!

What I did – switched to .ssh folder, then replaced contents of id_rsa key (as I understand, this is default ssh key of Android Studio) with contents of my ssh key.

Still don’t know the way, how can I point Android Studio to my ssh key, but in such way it works.

How to get it working using Android Studio on Windows and PuttyGen for generating the key – for dummies:

  1. Export your private key using PuttyGen to file Conversions>Export OpenSSHKey

  2. On the Windows machine where you have Android Studio installed go to your %USER%/.ssh directory.

  3. Copy the file exported in step 1 to this folder and change filename to “id_rsa”.

  4. In Android Studio menu go to VCS>Checkout from Version Control>Git.

  5. Paste Git url (as mentioned in other replies) and press “Clone”.

  6. It should ask you for password for the key file (if used) instead of a password for Git.

As @CodeWizard mentioned, Android Studio was getting the key from the OS so using ssh-add to add the keys to the ssh-agent worked for me.

ssh-add ~/.ssh/id_rsa

More info:

Leave a Comment