Wednesday, August 31, 2022

[SOLVED] Atlassian / BitBucket Sourcetree SSH Public Key Denied

Issue

I'm working on a project in a private repository on https://www.bitbucket.com.

I'm coding it locally, then staging, commiting and pushing the update via BitBucket's / Atlassian's Windows Git client, Sourcetree.

After that, I'm pulling the files from a remote shared server, which requires SSH authentication.

I've tried the following in order to connect the git repo with the BitBucket account:

  1. Launched the embedded Sourcetree SSH agent (Pageant)
  2. Added my .ppk (PuTTY Private Key) to Pageant using my passphrase
  3. Opened the SourceTree Terminal in the location of my project, let's call it C:/Project.
  4. Used git init to initialize the repository.
  5. Used git push -u origin --all in order to push the repo from my computer to BitBucket.
  6. Got this error: Permission denied (publickey).
  7. Tried to see if I can get some more verbose output by doing ssh -Tv [email protected] - Still, Permission denied.

I'm trying to figure out what exactly went wrong - did Sourcetee find my SSH key at all? Is the key not loaded in some specific place, causing this behavior?

Note: I have loaded the public key in my profile on BitBucket.


Solution

Well - I've found the solution after much trial and error. Apparently, using PUTTY's keygen and storing the new public key in my .ssh folder doesn't work. However, using ssh-keygen IN GIT BASH and then trying to login using the new generated key pair, works just fine. Out of curiosity though more than anything - I would love to know why this is the case.



Answered By - Tom Granot
Answer Checked By - Cary Denson (WPSolving Admin)