.hgrc 的部分

发布于 2024-10-05 22:43:57 字数 375 浏览 3 评论 0原文

我在本地网络上正确安装了 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

梦中楼上月下 2024-10-12 22:43:57

以下是它不起作用的原因以及应如何配置它:

您可以指定“schemes”选项或跳过它。 “方案”选项默认为“https”。因此,如果您不将方案包含在“前缀”选项中并且没有明确指定“方案”选项,您将得到以下结果:

# you specify:
[auth]
repo.prefix = server/repo_path
repo.username = username
repo.password = password

# you get:
[auth]
repo.prefix = server/repo_path
repo.username = username
repo.password = password
repo.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:

# you specify:
[auth]
repo.prefix = server/repo_path
repo.username = username
repo.password = password

# you get:
[auth]
repo.prefix = server/repo_path
repo.username = username
repo.password = password
repo.schemes = https

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.

哎呦我呸! 2024-10-12 22:43:57

看来您确实拥有正确的语法。两个潜在的问题:

(a) 也许您的前缀值错误。 您实际上应该使用 https 而不是 http 吗?

(b) 您确定远程计算机上的用户名和密码正确吗?

您可以使用用户名和密码 ssh 进入服务器吗?

此外,我对类似问题有一个很长的答案这里

什么对我有用

[ui]
username=Chris McCauley <[email protected]>

[auth]
repo.prefix = https://server/repo_path
repo.username = username
repo.password = password

克里斯

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

[ui]
username=Chris McCauley <[email protected]>

[auth]
repo.prefix = https://server/repo_path
repo.username = username
repo.password = password

Chris

最美不过初阳 2024-10-12 22:43:57

确保您使用的是相对较新版本的 Mercurial。我认为 [auth] 部分在 1.6 之前不存在。

作为后备方案,您始终可以将用户名和密码直接放入 HTTP URL(适用于任何 HTTP 站点):

http://frodo:[email protected]/hg/

但如果您可以使其正常工作,[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):

http://frodo:[email protected]/hg/

but if you can get it working [auth] is the cleaner route.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文