.hgrc 的部分
我在本地网络上正确安装了 Mercurial,现在我有了 hgusers,当有人尝试“推送”时,系统会要求他输入密码,如果他输入正确的密码,密码就会被接受。
问题是如何在每个用户的 .hgrc 文件中输入一次用户名和密码?我尝试了以下方法,但不起作用:
[auth]
localhost.prefix = http://192.168.0.1/hg/
localhost.username = frodo
localhost.password = ok123
我得到:
searching for changes
abort: authorization failed
请帮忙。谢谢。
I installed Mercurial correctly on the local network and now I have hgusers and when someone tries to "push" he is asked for password, if he enters the correct one the password is accepted.
The question is how can I enter the username and password once on each user's .hgrc file? I tried the following but it's not working:
[auth]
localhost.prefix = http://192.168.0.1/hg/
localhost.username = frodo
localhost.password = ok123
I'm getting:
searching for changes
abort: authorization failed
Please help. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
以下是它不起作用的原因以及应如何配置它:
您可以指定“schemes”选项或跳过它。 “方案”选项默认为“https”。因此,如果您不将方案包含在“前缀”选项中并且没有明确指定“方案”选项,您将得到以下结果:
结果配置与
http://server不匹配/repo_path
,并且身份验证不起作用。我建议始终在前缀或“方案”配置选项中指定方案以消除歧义。
docs 中对此进行了解释,但是您必须非常仔细地阅读它小心翼翼地得到它。
Here is why it did not work and how it should be configured:
You can either specify 'schemes' option or skip it. 'Schemes' option defaults to 'https'. Thus, if you don't include scheme into 'prefix' option and don't explicitly specify 'schemes' option, you will have this:
Resulting config does not match
http://server/repo_path
, and authentication does not work.I recommend to always specify scheme either in prefix or in 'schemes' configuration option for disambiguation.
And it is explained in the docs, but you have to read it very carefully to get it.
看来您确实拥有正确的语法。两个潜在的问题:
(a) 也许您的前缀值错误。 您实际上应该使用 https 而不是 http 吗?
(b) 您确定远程计算机上的用户名和密码正确吗?
您可以使用用户名和密码 ssh 进入服务器吗?
此外,我对类似问题有一个很长的答案这里
什么对我有用
克里斯
It really looks like you've got the correct syntax. Two potential problems:
(a) Perhaps you have the wrong value for the prefix. Should you actually have https rather than http?
(b) Are you sure that the username and passwords are correct on the remote machine?
Can you ssh into the server with the username and password?
Additionally, I have a long answer to a similar question here
What worked for me
Chris
确保您使用的是相对较新版本的 Mercurial。我认为
[auth]
部分在 1.6 之前不存在。作为后备方案,您始终可以将用户名和密码直接放入 HTTP URL(适用于任何 HTTP 站点):
但如果您可以使其正常工作,
[auth]
是更干净的路线。Make sure you're using a relatively recent version of mercurial. I don't think the
[auth]
section existed before 1.6.As a fallback you can always put username and password right into HTTP URLs (works with any HTTP site):
but if you can get it working
[auth]
is the cleaner route.