Converting PuTTY private keys to OpenSSH format

Overview:

This article will describe why Upsource doens't accept private keys generated in PuTTY and what to do in such cases.

 

Symptoms: 

When creating a new project in Upsource, you get to choose one of the following authentication methods to access your VCS: Anonymous, Password or SSH key. In case of SSH key, private key and passphrase(if any) should be provided. After that, while testing connection you might get the following error:

Test VCS connection failed.

List remote refs failed: com.jcraft.jsch.JSchException: Error while loading an uploaded key 'the-key': invalid privatekey

 

Solution:

Most likely your public/private key pair was generated via PuTTYgen. Upsource doesn't work with PuTTY-format private keys, so you would need to convert it to OpenSSH format. To do that, please perform the following steps:

  1. Open PuttyGen
  2. Click File -> Load private key
  3. Go to Conversions -> Export OpenSSH and export your private key
  4. Try to paste converted private key to Upsource

 

 

 

11 out of 22 found this helpful
3 comments

This is no help at all, it makes the assumption you are on Windows and not using the standard ssh lib on *unix based systems.

1
Avatar
Permanently deleted user

Invalid

```
-----BEGIN OPENSSH PRIVATE KEY-----
```


Correct

```
-----BEGIN RSA PRIVATE KEY-----
```

 

Step to fix

Remove old files

```
rm -rf ~/.ssh/*
```

Create new File (-m pem)

```
ssh-keygen -t rsa -b 2048 -m pem -f ~/.ssh/google_compute_engine -C username
```

0

to the person below me: 

puttygen exists on linux. its a command line application. this article assumes the user is windows because putty WAS the easiest way to use ssh so of course its not using the standard ssh libs. putty doesnt use them.

To convert an ssh key from putty to openssh using linux:
 

  1. install putty-tools(in debian, your distro may vary)
     
  2. puttygen keyfile.ppk -O private-openssh -o keyfile

 

done

0

Please sign in to leave a comment.

Have more questions?

Submit a request