Yosemite 上的 Mercurial 授权问题

Yosemite 上的 Mercurial 授权问题

我有一个本地 HG 存储库用于我的客户工作。我之前在早期版本的 OS X 上配置过 HG 服务器,没有任何问题,但在 Yosemite 上我遇到了问题。我使用了 MacPorts 的 mercurial 包,使用自签名 SSL 证书配置了 apache,基本一切正常……hgweb 运行良好,我可以拉取并执行其他命令。

但是我无法推动:

$ hg push --debug --traceback -v
pushing to https://localhost/hg/website.com
using https://localhost/hg/website.com
sending capabilities command
using auth.default.* for authentication
localhost certificate matched fingerprint ************
using auth.default.* for authentication
http auth: user mike, password ************
using auth.default.* for authentication
localhost certificate matched fingerprint ************
query 1; heads
sending batch command
using auth.default.* for authentication
searching for changes
all remote heads known locally
sending branchmap command
using auth.default.* for authentication
sending branchmap command
using auth.default.* for authentication
preparing listkeys for "bookmarks"
sending listkeys command
using auth.default.* for authentication
1 changesets found
list of changesets:
c05e7b9045cf27f7508dcaaace632ba8a9940c4e
bundling: 1/1 changesets (100.00%)
bundling: 1/1 manifests (100.00%)
bundling: file1.txt 1/2 files (50.00%)
bundling: file2.txt 2/2 files (100.00%)
sending unbundle command
sending 12141 bytes
using auth.default.* for authentication
sending: 11/22 kb (50.00%)
sending: 11/22 kb (50.00%)
Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/dispatch.py", line 138, in _runcatch
    return _dispatch(req)

...

  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/httppeer.py", line 172, in _call
    fp = self._callstream(cmd, **args)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/httppeer.py", line 122, in _callstream
    raise util.Abort(_('authorization failed'))
Abort: authorization failed
abort: authorization failed

用户名和密码是正确的……它们在 hgweb 界面上工作正常,甚至在前面的步骤(第 8 行)中的输出中也工作正常。我还多次检查了存储库的权限……_www 用户拥有完全访问权限:

$ ls -al /var/repos/website.com
total 0
drwxrwxr-x   3 _www  staff  102 Oct 19 23:34 .
drwxrwxr-x  11 _www  staff  374 Oct 27 02:09 ..
drwxrwxr-x  10 _www  staff  340 Oct 19 23:34 .hg

HG版本:3.1.2,OSX版本:10.10,Apache版本:2.4.9

如有任何帮助或建议我们将非常感激--提前谢谢!

答案1

我找到了答案。不确定为什么这样可以修复它,但我所要做的就是在相关存储库的 .hg 目录中创建一个 hgrc 文件(而不是本地克隆目录),然后添加:

[web]
allow_push = *

如果有人在尝试调试设置的不同部分时找到这个答案,这里是有关 Yosemite 上 Mercurial 的完整设置的教程。

http://www.curvingspace.com/2014/11/05/mercurial-on-yosemite/

相关内容