Builds fail with "invalid privatekey" and "Git capability is not defined. Falling back to JGit"

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

Builds fail during checkout, and the following two errors can be seen in the build logs:

1 2 3 Git capability is not defined. Falling back to JGit, which is no longer supported. Define native git capability to get rid of this error. ssh://<bitbucket>:<port>/<project>/<repo.git>: invalid privatekey:

Diagnosis

When reviewing the failed build logs, the following errors are present:

Git capability is not defined

1 error 19-May-2023 10:58:38 Git capability is not defined. Falling back to JGit, which is no longer supported. Define native git capability to get rid of this error.

Invalid privatekey

1 error 19-May-2023 10:58:38 Cannot fetch branch '<branch>' from 'ssh://<bitbucket>:<port>/<project>/<repository>.git' to source directory '<bamboo-agent-home>/xml-data/build-dir/_git-repositories-cache/<cache>'. ssh://<bitbucket>:<port>/<project>/<repository>.git: invalid privatekey: [B@5d42b0e

Cause

This happens when a native Git client is not installed in the remote agent (or in the Bamboo machine), which causes Bamboo to use its default JGit, which is known to have a few limitations.

Solution

Please make sure that a native Git client is installed on the agents and Bamboo machines, and that they are configured as capabilities:

Once Git has been installed:

  • Agents: eitherrestart them to pick up the Git path automatically orset it manuallyby going toBamboo Administration>Agents> open the agent's page >Add capability>Git.

    If you choose to restart the agent, you can check if the Git capability is now present under theBamboo Administration>Agents> affected agent's page.

  • Bamboo: go to Bamboo Administration> Server capabilities > click Detect server capabilities.

If you still see the "invalid privatekey" error after the steps above, please make sure the SSH keys have been correctly created and configured as per the following articles:

Updated on March 18, 2025

Still need help?

The Atlassian Community is here for you.