Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,462,882
Community Members
 
Community Events
176
Community Groups

SSH Permission Denied

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? 

2 answers

0 votes

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

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

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events