Bamboo fails to add Bitbucket Server repository: "Can't authenticate with Bitbucket Server despite successful public key storage"

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible


When adding/saving a Bitbucket Server linked repository in Bamboo, the following error message shows up:

Could not access this repository in Bitbucket Server

Bamboo was unable to verify connection to this repository. It might have been moved, deleted, or the current SSH key was revoked on Bitbucket Server. Click Save repository at the bottom of this screen to attempt to re-establish access to this repository.


Bamboo 7, 8, 9.


Looking at the logs, the following errors can be seen:

INFO [https-jsse-nio-8443-exec-18] [BitbucketServerServerConfigurator] Public key was added to Bitbucket Server (Bamboo user: admin, application: Bitbucket [https://git.repository], location: repository BP/bamboo-build-specs): ssh-ed25519 AHSJJRBBNSJSHDI1NTE5AAAGDHSIIQTOX/Ikendfganth0936+Ajdjdqpitsb https://repository.example
WARN [https-jsse-nio-8443-exec-18] [CacheAwareness$1] Inheriting disabledCaches:[com.atlassian.bamboo.ANY]
WARN [sshd-SshClient[7344e4e5]-nio2-thread-4] [LoggingUtils] exceptionCaught(ClientSessionImpl[git@git.repository/])[state=Opened] SshException: Server key did not validate
INFO [https-jsse-nio-8443-exec-18] [BitbucketServerServerConfigurator] Can't authenticate with Bitbucket Server despite successful public key storage: ssh-ed25519 AHSJJRBBNSJSHDI1NTE5AAAGDHSIIQTOX/Ikendfganth0936+Ajdjdqpitsb https://repository.example


The root cause can be one of the following:

  • If the Managing Trusted key is enabled in Bamboo;
  • If the user that created the Linked repository is deactivated;
  • When the access key is missing in the Bitbucket repository;
  • When Bitbucket is offline;
  • When the Application link is not properly configured;
  • When the repository has been removed or its name has been changed;
  • If a capability is not listed in Bamboo.


Please check the following solutions:

  • Check Manage trusted keys
    • Option 1: Disable the option 'Manage Trusted key' on  Bamboo Administration > Security > Security settings > Global security and permission properties, if not in use.
    • Option 2: Add the Repository SSH Host key to the Trusted keys. E.g:

      • Capture Bitbucket's SSH host public key:

        $ ssh-keyscan -p7999 bitbucket 2>/dev/null [bitbucket]:7999 ssh-rsa AHSJJRBBNSJSHDI1NTE5AAAGDHSIIQTOX......kendfgant

      • Add it to the Trusted Keys: Bamboo Administration > Trusted keys > Add keys where:
        • Host=<hostname>:<port> => bitbucket:7999
        • SSH key=<key type> <ssh host key> => ssh-rsa AHSJJRBBNSJSHDI1NTE...

  • Save the repository:
    • Make sure you are an admin user in Bitbucket because when a non-admin user saves the Linked repository and for whatever reason is deactivated, the Linked repositories will fail due to connections being based on that user's credentials.
    • Go to the Bamboo Linked repository, save the repository to a different project/repository and save it back to the original one.

  • Check Bamboo capabilities 
    • The issue can happen when a Git capability is not set on Bamboo and it impacts directly on the agents and builds execution. Please access Bamboo Administration > Overview > Server Capabilities and press 'Detect Server Capabilities'. This will force Bamboo to load all capabilities available.

Last modified on Oct 12, 2022

Was this helpful?

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