Upsource 2020.1 Help

Error: "Test VCS connection failed. Error while loading an uploaded key. Invalid privatekey"

When creating a new project in Upsource, you get to choose one of the following authentication methods to access your VCS:

  • Anonymous

  • Password

  • SSH key

If you select SSH key, you should also provide a private key and passphrase (if any). After that, while testing the 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

Cause #1

The key was generated by a recent version of ssh-keygen in a format that is not supported by Upsource. This key starts with:

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

Solution

Generate a key in the format that Upsource supports by adding the -m pem option to ssh-keygen.

For example: ssh-keygen -t rsa -b 2048 -m pem -f mykey

The correct key should start with:

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

Cause #2

Your public/private key pair may have been generated via PuTTYgen. Upsource doesn't support the PuTTY-format private keys.

Solution

Convert the PuTTY-format key to the 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. Paste the converted private key into Upsource.

Last modified: 02 April 2021