开发者

Mercurial, authentication by key

开发者 https://www.devze.com 2023-01-25 06:46 出处:网络
I have such section in my ~/.hgrc config file [auth] repo.prefix = ssh://hguser@192.168.132.72/repos repo.key = /hom开发者_开发知识库e/zerkms/.ssh/mercurial-repo/id_rsa

I have such section in my ~/.hgrc config file

[auth]
repo.prefix = ssh://hguser@192.168.132.72/repos
repo.key = /hom开发者_开发知识库e/zerkms/.ssh/mercurial-repo/id_rsa

But when I write:

hg clone ssh://hguser@192.168.132.72/repos/rps .

mercurial still requires password to enter.

What have I done wrong?

To prevent obvious questions:

Yes, there is a valid key in the specified path and it works if use it with ssh-agent.

My question is how to work with keys in [auth] section.


The following works for me (probably a new setting since the question was asked):

Add to hgrc:

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

-C to enable compression, -i to specify identity file. If the key is loaded into ssh-agent, I don't get asked again for passphrase.


auth isn't for SSH. The key needs to be loaded in another way. If it were just ~/.ssh/id_rsa it would be done automatically, as it's not you may need to do something to register it. Using ~/.ssh/id_rsa is the easiest way normally - put the contents of ~/.ssh/id_rsa.pub in ~/.ssh/authorized_keys on the target machine and you're ready.

0

精彩评论

暂无评论...
验证码 换一张
取 消