Not Able to Login to Bitbucket Repo Via Visual Studio Code Using App Password

Viewed 1664

I recently set up an app password for bitbucket, since they now require this as of March 1st when I am connecting to a repo via Visual Studio Code on my Mac.

However, I am having difficulty actually now getting connected. With a project loaded in Visual Studio Code which I had already cloned before, I entered the following in the terminal:

git remote set-url origin https://<firstname.lastname>:<app-password>@bitbucket.org/<organization>

Then when I try git push origin feature-branch

I get the following error in the terminal:

remote: Invalid credentials
fatal: Authentication failed for 'https://bitbucket.org/<organization>/'

What am I missing here?

By the way, I got the above directions from here: How to access bitbucket using app password

By the way, I also tried:

git remote set-url origin https://<firstname.lastname>:<app-password>@bitbucket.org/<organization>.git

Also, ideally I'd like to set global credentials, as I will always be targeting the same organization account, but different repos within it. Any ideas how to do this?

2 Answers

In the end, after trying many, many different command line entries, and reading through the not super clear documentation, I was able to get this to work with a Curl:

curl -u "<user>:<appPassword>" "https://api.bitbucket.org/<rootOrg>"

In other words, as an example:

curl -u "bill.smith:h8sdgj0dkdjjf0s00f" "https://api.bitbucket.org/superorg"

Got myself into a pickle. I created a readonly app password initially to ensure I didn't make any mistakes. Worked great.. until I tried to push :)

If you need to swap out your bitbucket app password in VS Code

  1. Go to Atlassian and create your new app password (with correct permissions)
  2. Copy your new app password somewhere safe
  3. Revoke the existing app password
  4. Attempt a pull\push in VS Code, you'll now get a (very subtle) prompt to enter a password. Use your new app password.

HTH

Related