Monday, November 1, 2021

[SOLVED] 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