Mercurial,通过密钥进行身份验证
我的 ~/.hgrc
配置文件中有这样的部分,
[auth]
repo.prefix = ssh://[email protected]/repos
repo.key = /home/zerkms/.ssh/mercurial-repo/id_rsa
但是当我写:
hg clone ssh://[email protected]/repos/rps .
mercurial 仍然需要密码才能输入。
我做错了什么?
为了防止出现明显的问题:
是的,指定路径中有一个有效的密钥,并且如果将其与 ssh-agent
一起使用,它就可以工作。
我的问题是如何使用 [auth]
部分中的密钥。
I have such section in my ~/.hgrc
config file
[auth]
repo.prefix = ssh://[email protected]/repos
repo.key = /home/zerkms/.ssh/mercurial-repo/id_rsa
But when I write:
hg clone ssh://[email protected]/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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
以下内容对我有用(可能是提出问题后的新设置):
添加到 hgrc:
-C 启用压缩,-i 指定身份文件。如果密钥已加载到 ssh-agent 中,则不会再次要求我输入密码。
The following works for me (probably a new setting since the question was asked):
Add to hgrc:
-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
不适用于 SSH。需要以其他方式加载密钥。如果它只是 ~/.ssh/id_rsa 它将自动完成,因为它不是您可能需要做一些事情来注册它。通常使用 ~/.ssh/id_rsa 是最简单的方法 - 将~/.ssh/id_rsa.pub
的内容放在目标计算机上的~/.ssh/authorized_keys
中你准备好了。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.