How to setup multiple ssh identities for single hg repository?

前端 未结 2 1940
北恋
北恋 2021-02-10 02:54

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

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

in my .hgrc. This works f

2条回答
  •  攒了一身酷
    2021-02-10 03:16

    In your ~/.ssh/config, add

    Host someserver.com
    IdentityFile ~/.ssh/id_rsa
    
    Host otherserver.com
    IdentityFile ~/.ssh/otherid_rsa
    

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

    See ssh_config for other options.

提交回复
热议问题