Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hg doesn't connect to bitbucket using a custom key

On my computer I have

.ssh/config:

Host bitbucket
    HostName bitbucket.org
    User hg
    IdentityFile ~/.ssh/id_rsa_pwd  

.hg/hgrc

[paths]
default = ssh://[email protected]/lohoris/varlibs

(running OSX 10.6)

I have exactly the same files on a debian server, but while "trying" a shell login works on both:

PTY allocation request failed on channel 0
conq: logged in as lohoris.

                           You can use git or hg to connect to Bitbucket. Shell access is disabled.
                                                                                                   Connection to bitbucket.org closed.

mercurial connection only works on my computer, while from the server it refuses to cooperate:

lohoris@office:~/www/varlibs$ hg pull
remote: Permission denied (publickey).
abort: no suitable response from remote hg!

This is the same message you get when the key is wrong, only it is not wrong of course (as I said, trying a ssh bitbucket does work).

It is likely using the wrong key, since it's not even trying to ask me the passphrase, but I can't fathom why.

like image 552
o0'. Avatar asked Feb 29 '12 10:02

o0'.


People also ask

How do I link my SSH key to Bitbucket?

From Bitbucket, go to the repository and click Repository settings. Click Access keys from the left menu. Press Add key. From the Add SSH key dialog, enter a Label and paste the public key from the clipboard.

Can I use the same SSH key for Github and Bitbucket?

Definitely YES. You can generate ssh key pair first, see How to generate, then go to . ssh directory, copy the content of id_rsa. pub, and paste into your github or bitbucket ssh setting area.

Can I use the same SSH key on two Bitbucket accounts?

You'll need to create an additional SSH key for each extra Bitbucket account you have or each computer you use. For example, if you have four Bitbucket accounts, you need to generate 3 new SSH keys, meaning you'll have 4 keys in all.


1 Answers

If you get “Permission denied (publickey)”, it just means that the public key required to access and push to the server cannot be found. To get around this you’re going to run the following commands:

ssh-agent
ssh-add <full path to your key file>
  • Troubleshooting SSH Issues
  • Set up SSH for Git and Mercurial (Mac OSX/Linux)

ssh -T [email protected] also is good and fast ssh-debugger

like image 136
Lazy Badger Avatar answered Sep 18 '22 00:09

Lazy Badger