如何为单个hg存储库设置多个ssh身份? [英] How to setup multiple ssh identities for single hg repository?

查看:69
本文介绍了如何为单个hg存储库设置多个ssh身份?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在对我的Merurial存储库使用ssh公钥身份验证.所以我有:

I am using ssh publickey authentication for my mercurial repository. So I have:

[ui]
ssh = ssh -i ~/.ssh/id_rsa -C 

在我的.hgrc中.这工作正常,并允许我推/拉到ssh认证的回购协议.但是,我希望能够推/拉到另一个需要不同身份的仓库.如何配置.hgrc文件,以便将身份绑定到特定路径.我想我想要这样的东西:

in my .hgrc. This works fine and allows me to push/pull to an ssh-authenticated repo. However, I want to be able to push/pull to another repo that requires a different identity. How can I configure my .hgrc file so the identity is tied to a particular path. I guess I'd want something like:

[ui]
one.prefix = someserver.com
one.ssh = ssh -i ~/.ssh/id_rsa -C
two.prefix = otherserver.com
two.ssh = ssh -i ~/.ssh/otherid_rsa -C

推荐答案

在您的~/.ssh/config中,添加

Host someserver.com
IdentityFile ~/.ssh/id_rsa

Host otherserver.com
IdentityFile ~/.ssh/otherid_rsa

和任何使用ssh连接到主机someserver.comotherserver.com的人(包括hg和交互式使用)将使用指定的标识文件.

and anybody (including hg and interactive use) using ssh to connect to hosts someserver.com or otherserver.com will use the specified identity files.

请参见 ssh_config 选项.

See ssh_config for other options.

这篇关于如何为单个hg存储库设置多个ssh身份?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆