apache Mercurial 推送,中止:授权失败
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/946745/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Mercurial push, abort: authorization failed
提问by Piotr Byzia
I'm having problems with pushing to mercurial repository:
我在推送到 mercurial 存储库时遇到问题:
$ hg push
pushing to https://user:***@hg.domain.com/X_repo
searching for changes
abort: authorization failed
The same URL (with the same credentials) is accessible through the web browser. Also, I tried it without embedding usr+pass into the URL.
可以通过 Web 浏览器访问相同的 URL(具有相同的凭据)。另外,我在没有将 usr+pass 嵌入 URL 的情况下尝试了它。
HTTPS is correctly configured, I tried both Basic and Digest auth -- without a luck.
HTTPS 配置正确,我尝试了 Basic 和 Digest auth - 没有运气。
Pulling (through HTTP) works fine.
拉取(通过 HTTP)工作正常。
I'm using hgwebdir to serve my repo.
我正在使用 hgwebdir 为我的 repo 提供服务。
What else should I check?
我还应该检查什么?
I found this: http://code.google.com/p/support/issues/detail?id=2580In my case it's not random, it happens every single time.
我发现了这个:http: //code.google.com/p/support/issues/detail?id=2580在我的情况下它不是随机的,它每次都会发生。
Relevant part of my vhost conf:
我的 vhost conf 的相关部分:
WSGIScriptAlias / /home/(...)/hgwebdir.wsgi
<Directory /home/(...)>
AuthType Basic
AuthUserFile /(...)/basic-password
AuthName (...)
Require valid-user
Order deny,allow
Allow from all
</Directory>
$ hg -v
Mercurial Distributed SCM (version 1.0.2)
Strangely enough hg outgoing works ok:
奇怪的是 hg 输出工作正常:
$ hg outgoing
comparing with https://hg.domain.com/X_repo
http authorization required
realm: ...
user: ...
password:
searching for changes
changeset: 64:...
tag: tip
user: ...
date: ...
summary: ...
采纳答案by Piotr Byzia
Problem turned out to be repo dir permissions. chown www-datasolved it...
问题原来是 repo dir 权限。chown www-data解决了...
回答by lukmdo
回答by Martin Geisler
It isstrange that you can run hg outgoingbut not hg pushsince it is my understanding that they both authenticate in the same way.
这是奇怪的是,你可以运行hg outgoing,但不能hg push因为这是我的理解是,他们以同样的方式既验证。
Unfortunately I'm not a hgweb expert. Please mail to the Mercurial list([email protected]) and/or come online in IRC (#mercurialon irc.freenode.net). There will be many more people to help you there. IRC is especially good since these things are much easier to debug interactively.
不幸的是,我不是 hgweb 专家。请邮寄到Mercurial 列表([email protected]) 和/或在 IRC 中在线(#mercurial上irc.freenode.net)。那里会有更多的人来帮助你。IRC 特别好,因为这些东西更容易交互调试。
回答by lko
For those with TortoiseHg pushing to a web server (another unauthorized user on another PC):
对于那些将 TortoiseHg 推送到 Web 服务器的用户(另一台 PC 上的另一个未经授权的用户):
In TortoiseHg: File - Settings - (Either globally or just for the current repository - tabs)then the Serversettings.
Web Server
在 TortoiseHg 中:File - Settings - (Either globally or just for the current repository - tabs)然后是Server设置。网络服务器
Push Requires SSL - No
Allow Push - *
This does the same thing through the UI as lukmdo's answer above (editing the hgrc file).
这通过 UI 执行与lukmdo上面的回答相同的事情(编辑 hgrc 文件)。
回答by nicorellius
My problem was a bit different. Password change triggered it... And I had a repo/.hgrcand a repo/.hg/hgrc. Not sure why, but these were conflicting.
我的问题有点不同。密码更改触发了它......我有一个repo/.hgrc和一个repo/.hg/hgrc. 不知道为什么,但这些是相互矛盾的。
For the record, the cleanest way I've found is to keep a global configuration file (on Windows C:\Users\<user>\mercurial.inior Linux /home/<user>/.hgrc) with all the configuration that applies to all repositories (profiles, plugins/extensions, repos, etc), and then per repo, just use something like:
作为记录,我发现的最干净的方法是保留一个全局配置文件(在 WindowsC:\Users\<user>\mercurial.ini或 Linux 上/home/<user>/.hgrc),其中包含适用于所有存储库(配置文件、插件/扩展、存储库等)的所有配置,然后是每个存储库,只需使用类似的东西:
[paths]
default = https://path/to/remote/repo
# any other repo-specific config
Why I had another repo-specific mercurial config file, I don't know -- now everything is cleaned up and working nicely.
为什么我有另一个特定于 repo 的 mercurial 配置文件,我不知道——现在一切都被清理干净并且运行良好。
回答by Kjetil Limkj?r
Just in case it might help someone - I encountered this error for unknown reasons, all permissions were OK, and just restarting apache solved it.
以防万一它可能对某人有所帮助 - 我因未知原因遇到此错误,所有权限都正常,只需重新启动 apache 即可解决。
回答by Moak
This happened to me after changing my bitbucket password, then although I used SourceTree to manage my password and I changed it globaly, one repo however had my old password hard-coded in REPO/.hg/hgrcchanged the line and all works again
这发生在我更改我的 bitbucket 密码后,然后虽然我使用 SourceTree 来管理我的密码并且我全局更改了它,但是一个 repo 将我的旧密码硬编码在REPO/.hg/hgrc更改了行并且所有工作再次

