如何使用BitBucket和GitHub的特殊SSH密钥来推/拉? [英] How to use special SSH key for BitBucket and GitHub to push/pull?
问题描述
bitbucket
和 github
。我怎么能告诉SSH使用一个特定的密钥为Bitbucket和另一个为GitHub? 所以,我有一个配置:
主机bitbucket
主机名207.223.240.182
用户hg
IdentityFile〜/ .ssh / bitbucket
当我调用 ssh bitbucket
时,ssh成功使用密钥登录并被踢出。但是当我尝试 hg pull
时,我看到远程hg没有响应。并且不会询问密码。
可以做什么? 解决方案
当您调用 时,为什么发布的问题中的配置不起作用, / code>,ssh会在您的配置文件中查找名为 它不适用于您的mercurial命令,因为远程服务器可能定义为 仅供参考,您也可以使用通配符进行模式匹配,例如: 也可以,因为在看在配置中,SSH将用其他的替换*。 I had Ubuntu 10.04 and recently upgraded to 11.10. Additional SSH keys stopped working. I have keys So, I have a config: When I call What can be done? For the little explanation on why the config posted in the question doesn't work but your answer does : When you call It wasn't working for your mercurial commands because the remote server is probably defined as FYI, you can also use wildcard for the pattern matching, for example : Would also work, because when looking at the config, SSH will replace the * with anything else. 这篇关于如何使用BitBucket和GitHub的特殊SSH密钥来推/拉?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! ssh bitbucket
bitbucket
的主机,该主机由主机
关键词。然后,使用 HostName
关键字,您可以定义要使用的真实主机名。在你的情况下,你定义了 bitbucket
作为IP 207.233.240.182的别名,我假设它是 bitbucket.org
$ b bitbucket.org
而不是别名 bitbucket
。在您将配置文件更改为您的答案中提出的配置文件后,ssh可以有效地将远程服务器与主机名相匹配,并且一切正常!
主机bitbucket。*
HostName 207.223.240.182
用户hg
IdentityFile〜/ .ssh / bitbucket
bitbucket
and github
, which I have in the websites. How can I tell SSH to use one particular key for Bitbucket and another for GitHub?Host bitbucket
HostName 207.223.240.182
User hg
IdentityFile ~/.ssh/bitbucket
ssh bitbucket
, ssh successfully logs in with the key and gets kicked out. But when I try hg pull
, I see "no response from remote hg." and the passphrase is not asked.ssh bitbucket
, ssh looks in your config file for a host named bitbucket
which is defined with the Host
keyword. Then, using the HostName
keyword, you can define the real hostname to use. In your case, you're defining bitbucket
as an alias for the IP 207.233.240.182 which I assume is the one for bitbucket.org
bitbucket.org
and not the alias bitbucket
. After you changed the config file to the one proposed in your answer, ssh can effectively match the remote server to the host name and everything is fine !Host bitbucket.*
HostName 207.223.240.182
User hg
IdentityFile ~/.ssh/bitbucket