DVCS Connector won't connect to Bitbucket, returns Invalid User/Team Account

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

Symptoms

The DVCS connector cannot connected to Bitbucket,displaying "Invalid user/team account" despite it being an existing account.

(Auto-migrated image: description temporarily unavailable)

The following appears in the atlassian-jira.log:

1 2 3 4 5 6 7 8 9 10 11 12 ERROR johndoe 683x5594x1 14uepci 160.53.250.126 /rest/bitbucket/1.0/organization/1/syncRepoList [plugins.dvcs.rest.RootResource] Could not refresh repository list com.atlassian.jira.plugins.dvcs.exception.SourceControlException: Failed to execute request https://bitbucket.org/api/1.0/users/johndoe_repo at com.atlassian.jira.plugins.dvcs.spi.bitbucket.BitbucketCommunicator.getRepositories(BitbucketCommunicator.java:157) at com.atlassian.jira.plugins.dvcs.service.remote.CachingCommunicator.getRepositories(CachingCommunicator.java:205) ... at java.lang.Thread.run(Unknown Source) Caused by: com.atlassian.jira.plugins.dvcs.spi.bitbucket.clientlibrary.request.BitbucketRequestException: Failed to execute request https://bitbucket.org/api/1.0/users/johndoe_repo at com.atlassian.jira.plugins.dvcs.spi.bitbucket.clientlibrary.request.BaseRemoteRequestor.requestWithoutPayload(BaseRemoteRequestor.java:295) ... Caused by: javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated at sun.security.ssl.SSLSessionImpl.getPeerCertificates(Unknown Source) at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:126)

Diagnosis

Check if JIRA is running on HTTPS with self-signed certificate.

Cause

JIRA does not trust the Bitbucket's certificate.

Solution

Resolution

Import the Bitbucket's public certificate into JIRA's trusted store. Steps as below:

  1. Download OpenSSL:

    Linux: http://www.openssl.org/

    Windows: http://gnuwin32.sourceforge.net/packages/openssl.htm

  2. Import the SSL certificate from Bitbucket:

    For Windows: double-click the openssl file from the directory that gets installed. Run

    1 s_client -connect bitbucket.org:443

    For Linux :

    1 openssl s_client bitbucket.org:443
  3. From the output, copy the alphanumeric string between lines which say 'BEGIN CERTIFICATE' and 'END CERTIFICATE' (inclusive).

  4. Copy the results into a file called bitbucket.cert using text editor.

  5. Exit the Command Prompt and fire up a new one

  6. Import the bitbucket.cert into JIRA's JRE keystore. ℹ️The location of the trusted store might be different as it can be customized in the JIRA Starting Option.

    For Windows:

    1 keytool -import -alias bitbucket.org -keystore "%JAVA_HOME%/jre/lib/security/cacerts" -file C:\path\to\bitbucket.cert

    For Linux:

    1 sudo keytool -import -alias bitbucket.org -keystore $JAVA_HOME/jre/lib/security/cacerts -file /path/to/bitbucket.cert

Alternatively, the downloading and importing certificate can be achieve using Portecle as shown in Connecting to SSL services.

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.