Bamboo can't authenticate with Bitbucket Data Center and shows "New access key is required but could not be added"
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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
Summary
When adding a Bitbucket Data Center repository in Bamboo, an error message appears:
"New access key is required but could not be added to Bitbucket Server. ssh://project/repo.git:7999/git: invalid private key: [X@xxxxxxxx..."
Environment
Bamboo 6.8, 7, 8, 9 running on Linux OS.
Diagnosis
Looking at the logs, the following errors can be seen:
1
2
3
2022-09-14 08:34:48,262 INFO [http-nio-8085-exec-3] [BitbucketServerServerConfigurator] Public key was added to Bitbucket Server (Bamboo user: <user_name>, application: Bitbucket [<bitbucket_URL>], location: repository /module): ssh-ed25519 <encrypted key> <bamboo_URL>
2022-09-14 08:34:48,269 INFO [http-nio-8085-exec-3] [BitbucketServerServerConfigurator] Can't authenticate with Bitbucket Server despite successful public key storage: ssh-ed25519 <encrypted key> <bamboo_URL>
Cause
This issue can happen when a Git capability is not set on Bamboo Administration > Overview > Server Capabilities, causing Bamboo to use JGit. JGIt has been deprecated since the Bamboo 6.8 release and is not supported in production environments.
You can check if that's the case by generating a Support Zip, and then look for the Git capability inside application-properties/application.xml
1
2
3
4
5
6
<git>
<capability>org.eclipse.jgit</capability>
<path>N/A</path>
<version>N/A</version>
<is-executable>false</is-executable>
</git>
Solution
Install the Git package on the Bamboo machine and restart Bamboo. After that, please validate if the Git executable is detected onBamboo Administration > Overview > Server Capabilities.
If Git is already installed and hasn't been detected, please access BambooAdministration > Overview > Server Capabilities and press 'Detect Server Capabilities'. This will force Bamboo to load all capabilities available.
Git should also be installed on any Remote Agents and its location be listed on the OS $PATH so Bamboo can detect it.
You can check Agent-specific capabilities via BambooAdministration > Overview > Agents > |Select an agent| > Capabilities
Was this helpful?