Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to setup SSH authentication between my VPS and Bitbucket for configure later automatic deployment via Capistrano (for web projects) and Capifony (for Symfony2 projects) so I follow this steps:

  1. Login in my VPS as root and execude the command cd ~ and that point me at /root home.
  2. Run the command ssh-keygen -t rsa -C "my_email@example.com"
  3. Then I added the key to ssh-agent by running the command ssh-add ~/.ssh/id_rsa
  4. Finally I try to test if all goes fine by running ssh -T "my_email@example.com"@bitbucket.org but get this error:

Permission denied (publickey).

What I miss? Any help or advice?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

Did you add the public key to your bitbucket account? It should likely be added as a deploy key, giving it read-only access to your repo(s).

Additionally, all bitbucket URLs are of the form:

git@bitbucket.org:<repo_name>

I'm not sure where you're getting the idea to try and authenticate with your email address, but that's not going to work.

To test if your key has been added correctly, you'll need to follow the same pattern as the repo URLs use:

$ ssh git@bitbucket.org

Read up on bitbucket's documentation - they lay all of this out for you.

share|improve this answer
    
So, adding key as "deployment key" wouldn't work? Why? This is my repo URLs: reynierpm@bitbucket.org/reynierpm/mapyet2.git how do I test authentication using that URL? The idea comes from here maybe I'm trying to use the right configuration in the wrong place –  ReynierPM May 19 at 19:10
    
Nevermind the problem was the URL's I was using I tried now with ssh -T git@bitbucket.org and get a success message authenticated via a deploy key. You can use git or hg to connect to Bitbucket. Shell access is disabled. thanks for your answer –  ReynierPM May 19 at 19:12

You need to copy the public key ~/.ssh/id_rsa.pub to the destination host. How you do that on bitbucket I don't know.

share|improve this answer
    
I already did that following this guide –  ReynierPM May 19 at 19:02
1  
@ReynierPM you should have mentioned that in your question. I just tried following the guide and it worked as expected so you must have made a mistake. –  Iain May 19 at 19:14
    
He messed up the repo URL. –  EEAA May 19 at 19:55
    
@EEAA Yup I could see that once I had had a play myself. –  Iain May 19 at 19:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.