padlock and computer screen - cartoonish on a blue background.

Overcome the Bitbucket Authentication Blues

TL;DR

Although it was my fault, GitLab has been completely unhelpful getting me back into my account, so I decided to try Bitbucket. However, there were a couple gotchas which I cover in more detail, but the short version is:

Picture of dead sea scroll cave with "Support Mindfuel Blog on Patreon" shamelessly promoted on top
  • If your username is in use elsewhere, Bitbucket will assign one to you and it isn’t entirely obvious how to deal with it or change it. It can be done here: https://bitbucket.org/account/settings/
  • Once you have your username, when you try to use it to clone a repo, you might be surprised to find out they don’t accept your username and password used to login to your account as the credentials for cloning. That can be fixed by using an “app password”, created here: https://bitbucket.org/account/settings/app-passwords/

My Achy Breaky GitLab Heart

I recently had to change my phone number. I mean, that wasn’t my goal, but two cellular providers failing to port my number and then telling me a story that went something like this:

“Sir, we regret to inform you your cell phone number is . . . “

This event broke MFA (Multi-Factor Authentication) for a lot of my vendors, and sadly, Gitlab was the least capable of fixing things. Think about that for a moment, as these are the folks you trust to build and run your enterprise apps. Oh wait, they bill for that, and if I was a paying customer then they would help me fix my phone number. Mmm. Yeah, that’s so much better.

Now, full disclosure, GitLab has these clever one-time use codes that they give out. I went looking for mine. And looking, and looking. If you ever find them, let me know (or don’t, you #new-world-hacker you). Ergo, this is kinda my fault, but still I was able to contact EVERY other vendor (who doesn’t hand out those slick codes), and change my phone number. No problems. Gitlab’s response:

And with that, they closed the ticket. And with that, I went shopping for another platform.

Platform Shopping

There are many platforms to choose from, my list is hardly exhaustive. I looked into Bitbucket, Sourceforge, Codeberg, Gitea and SourceHut. For my use case, Bitbucket seemed a good fit but I do like the idea of SourceHut. I might revisit that. If I do, and “JabbaThe” is available as a user name, we can have JabbaThe SourceHut(t). I am looking forward to that day.

The Bitbucket Authentication Blues

I created my Bitbucket account, it prompted me to create a workspace, and then a project/repo. Things were going to plan until I tried to clone the repo to my local machine. I gleefully copied the clone text, pasted it to my command line and was prompted to supply a password for the user “code86”. I am not knocking that username, but that was NOT my username. And when I used my password, I got an “authentication failure” error.

Now, I could go on for paragraphs with all the stuff I tried. You know me, paragraphs are nothing. Even ChatGPT is like, “Dude, can you stop typing and let me reply?” But I will spare you all that, and just get to the meat and potatoes. Or, the meat-substitute and potatoes. Or just potatoes. Or no potatoes.

Fix 1: The Random User Name

Turns out, in Atlassian land, your email/password is your overarching Atlassian account, which can then receive permissions to user things like Bitbucket. Bitbucket derives a username from your account information, and then doesn’t make it entirely obvious what they selected unless you look at that “clone” button on the repo – it is definitely there.

In my case it was wrong. No worries, it can be changed to something else, provided that the name you choose isn’t already in use. Navigating there was weird, but in case the endpoint changes it is top-right ‘settings’ icon, then over to ‘products’ tab, then select ‘Bitbucket’ from that list and as of this writing, you end up at this endpoint: https://bitbucket.org/account/settings/

From there you can supply a new username and it will complain if it is already in use. Mine was. So, I added a hyphen. That way, it would be like the antimatter version of my GitLab username. If those ever both meet, we will get a sound and lights show.

Fix 2: Crouching App Hidden Password

Unfortunately, even with this resolved, it didn’t fix my error. Atlassian does not appear to use your account credentials with Bitbucket. And there are MULTIPLE ways to solve this (I am not touching on SSH, for example). However, I wanted this HTTPS clone thing to work. No good reason why, just did.

I stumbled into this stack exchange article, and it worked. From the same URL above, you can set an app password and give it permissions to your repos:

From there, a password is generated for you:

Note: I deleted that one, since, well, screenshot. 🙂 But you get the idea.

Now the clone HTTPS command should work unless you have an existing Git configuration with global settings that don’t match or other situation afoot, but let’s hope not. Just to be clear, you use the user name from Fix 1 above (even if you didn’t change it, make sure that is the user name being used when you clone your repo), and the password generated in this fix, and you should be good to go!

Image Credits

Bitbucket Blues © 2024 by MindFuel Blog is licensed under CC BY-SA 4.0

While the banner image in this post was derived from Sage, an artificial intelligence, the text of this post was 100% human-generated.

Leave a Comment

Your email address will not be published. Required fields are marked *