Bitbucket login without 2FA code Edited

Hello to everyone,

Unfortunately i was forced to factory reset my phone and i didn't export my 2FA codes before hand.

I also have not saved my recovery codes or simply cannot find them.

From reading the docs i understand that if i have an SSH key i can still get my recovery codes through the

ssh git@bitbucket.org recovery_codes

command.

However i am quite new to git in general and have also been using the git client GitKracken (Linked to bitbucket).

Now, when i run the command from my terminal i get the

Error: Permission denied (publickey)

error, but my client is still connected to bitbucket and i can push/pull and clone just as before.

From my understanding, if GitKracken is connected to bitbucket then it must have saved an authorized SSH key somewhere and i should find that key and move it to my home/.ssh/ folder.
Is this correct or am i missing something obvious?

Any help would be appreciated because (client aside) i am locked out of my account.

Thanks a great lot to everyone!

 

2 answers

0 vote

 

 

Hi Justin! Looks like Bitbucket could not authenticate you, can you run this command from your terminal and show us the output? This will attempt to create a connection to Bitbucket for Git and tell you which username is using: 

ssh -Tv git@bitbucket.org

You can also run this command to see which key is your SSH agent currently offering:

ssh-add -L

Note that with ssh-agent management Bitbucket uses the first key on the list.

From my understanding, if GitKracken is connected to bitbucket then it must have saved an authorized SSH key somewhere and i should find that key and move it to my home/.ssh/ folder.
Is this correct or am i missing something obvious?

Yes, that is correct. Please follow my instructions above and let us know your findings!

Best regards,

Ana

Hello Ana,

Thanks for your answer.

The first command outputs a few lines where it seams it is attempting a connection to bitbucket but unfortunately it ends in:

debug1: No more authentication methods to try.
Permission denied (publickey).

The second command outputs:

The agent has no identities.

So it seams like my ssh client does not have the keys stored where it expects them to be.

But i can confirm that my git client (GitKraken) still has a working connection.

Thanks again,
Justin

Hello Justin, you'll need to find where the SSH key is stored and move it to the default location.

Regarding GitKraken, if still has a connection it could be because it has access to the SSH key somewhere, or maybe because the previous session hasn't been killed yet. If it's the first one, try to find where the SSH key is located. Otherwise, I'm afraid, you won't be able to obtain the recovery codes. 

Let us know!

Ana

And this is exactly the uselessness of 2FA for Bitbucket, because every other paid vendor provides some recovery option, even if by postal mail, in cases like this.

Hi Erika, I've never heard of postal mail being an option. As is the standard, we provide 3 ways of obtaining a code:

  1. Authenticator apps.
  2. Recovery Codes.
  3. SSH Recovery.

These options are widely used across different companies (Github and Google for example) and its advantages and risks are listed in many articles, like Don't get locked out when using 2FA.

There is no other way to obtain a code outside of these options. When you enable 2FA, you are committing to making that account accessible only to a user that is able to obtain a 2FA code. For more information you can see Retrieve recovery codes through SSH.

Please let us know if you have any other questions or there's something else I can help you with.

Regards,

Ana

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

22,248 views 26 11
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you