Error while opening SSH session when using putty format keys

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

Bamboo and Stash are integrated correctly following the instructions: Integrating Bamboo with Stash. Operating system is Windows and Bamboo is running as a Windows service with a local admin account, so there are no issues accessing <bamboo-home> and <bamboo-installation> directories. "msysgit 1.9.x" is correctly installed and a path to the executable is added under Bamboo Administration - > Server Capabilities. Stash is added as a shared repository. Key pairs are generated and exist in both Stash and Bamboo. Despite having all settings correctly in place, following error keeps showing up when running builds:

error:
[Warning: Permanently added '[127.0.0.1]:54364' (RSA) to the list of known hosts., BAMBOO-SSH-PROXY: [While connecting to [ssetayeshfar@/172.20.111112.23544:7990]: Error while opening SSH session: java.lang.NullPointerException: neither the key pair nor the password is set], fatal: Could not read from remote repository., , Please make sure you have the correct access rights, and the repository exists.]
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceLastBuildInternal(DefaultChangeDetectionManager.java:371)
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceRevisions(DefaultChangeDetectionManager.java:259)

Cause

Though there are different root causes for this issue, one of the main ones is using keys that are in putty format. Putty is the only application that can read these keys natively. So, in order for them to work correctly with Bamboo, they should be converted to OpenSSH format. The problem can also be caused by the keys not making it through the proxy. 

Resolution

  1. Bamboo code will look for the keys on the file system only if the key is not found in the db. Make a back up of your Bamboo database, a copy of the <bamboo-home> directory, then run the following query to check if keys exist in Bamboo's database:

    select name, xml_definition_data from vcs_location where is_global=true;
  2. Double check your proxy settings and make sure your keys can travel with no issues.

  3. If using "PuttyGen" to generate the keys, convert them to OpenSSH following the instructions provided in this document: How to convert .ppk keys to openSSH.

Last modified on Nov 1, 2018

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.