Cedric
Cedric

Reputation: 1000

Bitbucket ssh publickey denied

I've tried everything for hours without success, so I finally decided to ask here. I have an ssh key-pair 'id_rsa' for github, and created another one (for the 3rd time at least) 'bitbucket_id_rsa' for bitbucket.

Running ssh -T [email protected] I always get 'Permission denied (publickey).' For github it works.

If I run: eval $(ssh-agent), then ssh-add ~/.ssh/bitbucket_id_rsa, then it (ssh -T [email protected]) works, I'm successfully logged in. But every time I close the terminal and open it again, it's again 'Permission denied'.

What should I do (I'm using Windows btw). Must I create a config file?

Upvotes: 1

Views: 435

Answers (1)

VonC
VonC

Reputation: 1328972

Using ssh -T [email protected] would look for ~/.ssh/id_rsa/id_rsa.pub keys, not for bitbucket_id_rsa

Create a~/.ssh/config file with:

Host bb
   Hostname bitbucket.org
   User git
   IdentityFile C:\path\to\bitbucket.org

(this works for Windows too, where ~ is %USERPROFILE%)

Then try ssh -Tv bb

Upvotes: 1

Related Questions