Windows hg授权失败

时间:2014-07-13 16:03:16

标签: windows mercurial authorization credentials http-status-code-401

我在Windows中有一个hg存储库,但是有以下命令:

hg pull
hg push
hg incoming
hg outgoing

都有结果:

abort: authorization failed

当我尝试通过网络浏览器访问我的存储库时,它会询问我的凭据。我输入了它们,我可以通过网络浏览器轻松访问它们。

在我的mercurial.ini文件中,我添加了

[auth]
bb.username = MyUserName
bb.password = MyPwd

我已经检查过环境变量HGRCPATH是否正确,但它没有解决任何问题。

hg incoming --debug --traceback 的输出为:

using http://My/Repo/url.com
sending capabilities command
Traceback (most recent call last):
File "mercurial\dispatch.pyc", line 97, in _runcatch
File "mercurial\dispatch.pyc", line 778, in _dispatch
File "mercurial\dispatch.pyc", line 549, in runcommand
File "mercurial\dispatch.pyc", line 869, in _runcommand
File "mercurial\dispatch.pyc", line 840, in checkargs
File "mercurial\dispatch.pyc", line 775, in <lambda>
File "mercurial\util.pyc", line 512, in check
File "mercurial\extensions.pyc", line 143, in wrap
File "mercurial\util.pyc", line 512, in check
File "hgext\mq.pyc", line 3528, in mqcommand
File "mercurial\util.pyc", line 512, in check
File "mercurial\commands.pyc", line 3854, in incoming
File "mercurial\hg.pyc", line 548, in incoming
File "mercurial\hg.pyc", line 500, in _incoming
File "mercurial\hg.pyc", line 122, in peer
File "mercurial\hg.pyc", line 102, in _peerorrepo
File "mercurial\httppeer.pyc", line 264, in instance
File "mercurial\httppeer.pyc", line 57, in _fetchcaps
File "mercurial\httppeer.pyc", line 197, in _call
File "hgext\largefiles\proto.pyc", line 174, in httprepocallstream
File "mercurial\httppeer.pyc", line 121, in _callstream
Abort: authorization failed
abort: authorization failed

1 个答案:

答案 0 :(得分:0)

如果您在mercurial.ini的[auth]部分中拥有所有内容,那么您将错过所需的.prefix条目。它需要知道使用该用户名和密码的网站。有关如何使用prefix

的详细信息,请参阅http://www.selenic.com/mercurial/hgrc.5.html#auth

还要确保在执行hg paths时看到http / s网址。如果您看到ssh网址,则需要设置密钥而不是密码(或切换到http / s网址)。