VS code unable to use SSH to push and pull from Bitbucket

Issue

Currently, I’m using source tree to push & pull from Bitbucket with SSH.

However, when I try to use VS Code to do the same thing, it ask for a password.

And I get the following error after entering my Bitbucket password:

remote: Invalid username or password
fatal: Authentication failed for 'https://bitbucket.org/repo/repo.git/'

I searched for a few articles, but nothing I tried seemed to be working.

I’m on an M1 Macbook – OS Big sur.
This is for my professional Bitbucket account.

This was one of the docs I follow: https://support.atlassian.com/bitbucket-cloud/docs/set-up-an-ssh-key/

Solution

Try and switch to command line, and go to the root folder of your local repository.

Check your remote URL with git remote -v: if it starts with https://, it won’t use SSH. At all.

Switch to ssh: git remote set-url origin [email protected]:<me>/<MyRepo> (<me> and <myRepo> are placeholder values for you to replace: don’t use < and >)
Test also your SSH key was correctly registered to your BitBucket account: ssh -Tv [email protected].

Then switch back to VSCode, and see if your issue persists.

Answered By – VonC

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published