Test Bitbucket Cloud service credentials

Platform Notice: Cloud Only - This article only applies to Atlassian apps on the cloud platform.

Summary

The purpose of this article is to test newly created service credentials to Bitbucket.  This will cover SSH keys and API tokens.

Solution

Solution #1 - SSH keys

You can find the articles now how to set up repository access keys on this page.

ssh -v -i ~/.ssh/<BBSSHKey> <UserName>@bitbucket.org

Replace <BBSSHKey> with the name of the private ssh key file, whose public key you have uploaded to Bitbucket. 

Expected successful output

Bitbucket Cloud does not allow for any shell access, so if a terminal session asks for an interactive shell, it will terminate the output.  The test above requests by default the interactive session so we expect to get this error.

You can use git to connect to Bitbucket. Shell access is disabled

This is the error in context.

... PTY allocation request failed on channel 0 authenticated via ssh key. You can use git to connect to Bitbucket. Shell access is disabled debug1: client_input_channel_req: channel 0 rtype exit-status reply 0 debug1: channel 0: free: client-session, nchannels 1 Connection to bitbucket.org closed. Transferred: sent 2608, received 1936 bytes, in 0.1 seconds Bytes per second: sent 25913.4, received 19236.3 debug1: Exit status 0 $

Solution #2 - API token

This is the documentation on API tokens. Please be mindful that you need to set the scopes when you create an API token, and the scopes determine which API endpoints this token can be used with.

You can find the scopes required for each endpoint in our API documentation; navigate to the API endpoint you want to use from the left sidebar, then select it, and you will see the scopes required for this endpoint.

curl -vvv -u "<username>:<appPassword>" "https://api.bitbucket.org/2.0/user"

Replace <api_token> with the API token and <atlassian_account_email> with your Atlassian account email address.  Note that the API token name is not used in the REST calls.

Expected successful output

The call should get a http 200 and json with your user's information.

* Connection state changed (MAX_CONCURRENT_STREAMS == 200)! < HTTP/2 200 < server: nginx ... < {"display_name": ... "account_status": "active", "location": null}

Updated on September 26, 2025

Still need help?

The Atlassian Community is here for you.