I set up an SSH key by following the instructions for Mac here: https://support.atlassian.com/bitbucket-cloud/docs/set-up-an-ssh-key/#Set-up-SSH-on-macOS-Linux
After setup, I ran "ssh -T git@bitbucket.org" to test the connection and got the classic "Permission denied (publickey)". So I looked at the troubleshooting section here:
https://support.atlassian.com/bitbucket-cloud/docs/troubleshoot-ssh-issues/
and none of the scenarios described for my particular error seem to match. As an experiment, I set the same ssh key up with GitHub (which is basically the same process) and the ssh test worked just fine. In addition, I was able to clone a repo on Bitbucket using ssh, even though the connection test never works. What in the world is going on?
Hi Brian and welcome to the community.
One possible reason I can think of is that the private key offered when you run ssh -T git@bitbucket.org may be different than the key offered when you clone.
You can see what key is being offered in the first case if you run ssh -Tvvv git@bitbucket.org, the key offered should be shown in the output.
You can create a file named config in your ~/.ssh directory and add the following (if the file exists, just add the following lines):
Host bitbucket.org
HostName bitbucket.org
PreferredAuthentications publickey
IdentityFile /Users/Username/.ssh/id_rsa
where /Users/Username/.ssh/id_rsa replace with the path to the private SSH key whose public key is uploaded to Bitbucket, to ensure that this key will be offered.
Kind regards,
Theodora
@Brian Dannenmueller Welcome to the Atlassian Community
Have you tried this https://confluence.atlassian.com/bbkb/permission-denied-publickey-302811860.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Brant, thanks for your swift reply! Yes, I have seen this page and checked out all of the scenarios, but none seem to apply:
1) I have verified that my ssh-agent is up and running and my key is loaded
2) I have verified that my key is uploaded to Bitbucket, and can screenshot if necessary.
3) Git clearly has permission to write to my filesystem, since I've been able to use it to download repos, even with ssh. It's the test command that mysteriously fails.
Like before, issuing the
ssh -T hg@bitbucket.org
results in the same Permission denied (publickey). Real head scratcher here!
By the way, I am using a MacBook Pro 2019, Monterey 12.2.1
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.