4

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?

ReynierPM
  • 710
  • 5
  • 14
  • 30

2 Answers2

4

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.

EEAA
  • 109,363
  • 18
  • 175
  • 245
  • 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](https://help.github.com/articles/generating-ssh-keys) maybe I'm trying to use the right configuration in the wrong place – ReynierPM May 19 '14 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 '14 at 19:12
2

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.

user9517
  • 115,471
  • 20
  • 215
  • 297