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 "[email protected]"
  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 "[email protected]"@bitbucket.org but get this error:

Permission denied (publickey).

What I miss? Any help or advice?

2 Answers 2


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:

[email protected]:<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 [email protected]

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

  • So, adding key as "deployment key" wouldn't work? Why? This is my repo URLs: [email protected]/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, 2014 at 19:10
  • Nevermind the problem was the URL's I was using I tried now with ssh -T [email protected] 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, 2014 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.

  • I already did that following this guide
    – ReynierPM
    May 19, 2014 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.
    – user9517
    May 19, 2014 at 19:14
  • He messed up the repo URL.
    – EEAA
    May 19, 2014 at 19:55
  • @EEAA Yup I could see that once I had had a play myself.
    – user9517
    May 19, 2014 at 19:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .