Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

how to get recovery code with only public keys and private keys

Hi All,

i have lost my recovery code and 2FA is enabled in my account. Now I have also lost the APP from mobile I am not able to login to bitbucket. When I try to use ssh for recovering the recover codes it says "ssh is not found as internal or external command".

I have public key and private key in my system but not in .ssh folder which is generally place in ~/user/.ssh location. I have saved them in another folder. 

providing the only option of these 2 keys how can i recover my recovery codes to get access to my account? Please if someone can guide me step by step for doing all of the stuff.

1) How to run ssh command and where to run it? through command prompt or in git bash?

2) As my public key is already added while setting up the bit bucket account how can i use public key and private key to get the recovery codes?




1 answer


Thats good that you have the ssh key with you. Try typing this command in the terminal you usually work with bitbucket.

ssh recovery_codes

Then 6 recovery codes will be provided

Where to fire this command? When I do this on CMD prompt then it gives error "command not found"

If you are on a Windows computer either install Putty or follow the directions here to enable these commands.

Thanks for this. But I am using Window server 2012. My machine is hosted on window server to connect to a remote machine.

Can you please for this setup?



Download and install it, will work fine on Windows. Once you open the promt and SSH to your server...wait a minute are you running BB on Windows? May still work..

Is it showing "ssh is not found as internal or external command", if this is the case then ssh is not installed, you need to install ssh.

If ssh is already installed then set environment variable path.

How was the ssh key generated earlier? as you mention you have private and public keys with you.

And as you mention that you have stored your private key in another folder try to provide the path where your private key is stored.

Another thing is that you can try using putty.

Hi @Ganesh Babu 

I have generate the keys using puttyGen and stored the public key into bitbucket setting.

When I am trying putty and hit the server it says Authentication failed (public key) error.


What should be the next step you suggest?

We have a script for our Jira instance to change SSO to secondary. Here are the docs for doing this in Bitbucket but I am not sure it will help. I would reach out to Atlassian support. 

Hi @Abhishek.SinghSolanki 

Better try with command prompt/git bash. 

Check whether the ssh installed. If not install the ssh. Please find the attached document that i followed. I have ssh installed and performed with git bash

And check whether do you have one or multiple private keys. If multiple provide the appropriate private key that is associated with the public key.

As you mentioned you generated it with putty , when trying with command prompt or git bash try to convert the ppk file to private key.

So these attached screenshot might help once all these are done jira5.png

I am not sure how to connect to bitbucket cloud with putty because the hostname or ip address should be defined inorder to connect to it. While if it server we can work around with it

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

1,787 views 0 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you