2

我正在使用 mercurial,当我尝试使用 hg push 时,出现此错误:

abort: HTTP Error 500: No such file or directory

服务器信息:

  • 使用 Mercurial 的 Nginx
  • Debian 7.1

知道为什么吗?拉动工作正常。

编辑:通过启用 http 推送,我可以看到堆栈跟踪:error.html

EDIT2:但是,如果我禁用使用 http 的可能性,最初的错误就会回来。

EDIT3:这是我进行引用时的错误:

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 87, in _runcatch
    return _dispatch(req)
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 684, in _dispatch
cmdpats, cmdoptions)
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 466, in runcommand
ret = _runcommand(ui, options, cmd, d)
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 738, in _runcommand
return checkargs()
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 692, in checkargs
return cmdfunc()
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 681, in <lambda>
d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
  File "/usr/lib/python2.7/dist-packages/mercurial/util.py", line 458, in check
return func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mercurial/commands.py", line 4338, in push
newbranch=opts.get('new_branch'))
  File "/usr/lib/python2.7/dist-packages/mercurial/localrepo.py", line 1535, in push
ret = remote.unbundle(cg, remote_heads, 'push')
  File "/usr/lib/python2.7/dist-packages/mercurial/wireproto.py", line 300, in unbundle
ret, output = self._callpush("unbundle", cg, heads=heads)
  File "/usr/lib/python2.7/dist-packages/mercurial/httprepo.py", line 199, in _callpush
r = self._call(cmd, data=fp, headers=headers, **args)
  File "/usr/lib/python2.7/dist-packages/mercurial/httprepo.py", line 169, in _call
fp = self._callstream(cmd, **args)
  File "/usr/lib/python2.7/dist-packages/mercurial/httprepo.py", line 117, in _callstream
resp = self.urlopener.open(req)
  File "/usr/lib/python2.7/urllib2.py", line 406, in open
response = meth(req, response)
  File "/usr/lib/python2.7/urllib2.py", line 519, in http_response
'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.7/urllib2.py", line 438, in error
result = self._call_chain(*args)
  File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain
result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 890, in http_error_401
url, req, headers)
  File "/usr/lib/python2.7/dist-packages/mercurial/url.py", line 429, in http_error_auth_reqed
self, auth_header, host, req, headers)
  File "/usr/lib/python2.7/urllib2.py", line 865, in http_error_auth_reqed
response = self.retry_http_basic_auth(host, req, realm)
  File "/usr/lib/python2.7/urllib2.py", line 878, in retry_http_basic_auth
return self.parent.open(req, timeout=req.timeout)
  File "/usr/lib/python2.7/urllib2.py", line 406, in open
response = meth(req, response)
  File "/usr/lib/python2.7/urllib2.py", line 519, in http_response
'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.7/urllib2.py", line 444, in error
return self._call_chain(*args)
  File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain
result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 527, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 500: No such file or directory
abort: HTTP Error 500: No such file or directory

编辑 4: 放置在 /usr/mercurial 中的 repos hgrc 文件如下所示:

[web]

deny_push = root, mdpiadmin, www-data
allow_push = milos
contact = Geeks MDPI AG
verbose = true

[trusted]
users = www-data
groups = www-data

[ui]
editor = nano
merge = vimdiff

EDIT5:ngnix 错误日志:

这是我尝试推送时 ngnix 端的错误日志:

2013/07/29 11:07:45 [error] 14450#0: *19 no user/password was provided for basic authentication, client: 172.16.0.89, server: hg.mdpi.intra, request: "GET /psan2.5-admin?cmd=capabilities HTTP/1.1", host: "hg.mdpi.intra"
2013/07/29 11:07:48 [error] 14450#0: *20 no user/password was provided for basic authentication, client: 172.16.0.89, server: hg.mdpi.intra, request: "GET /psan2.5-admin?cmd=batch HTTP/1.1", host: "hg.mdpi.intra"
2013/07/29 11:07:48 [error] 14450#0: *22 no user/password was provided for basic authentication, client: 172.16.0.89, server: hg.mdpi.intra, request: "GET /psan2.5-admin?cmd=branchmap HTTP/1.1", host: "hg.mdpi.intra"
2013/07/29 11:07:48 [error] 14450#0: *24 no user/password was provided for basic authentication, client: 172.16.0.89, server: hg.mdpi.intra, request: "POST /psan2.5-admin?cmd=unbundle HTTP/1.1", host: "hg.mdpi.intra"

EDIT5:这是 repos ngnix 设置:

server {
listen              443 ssl;
server_name         hg.mdpi.intra;

ssl_certificate      /etc/ssl/certs/hg.mdpi.intra.crt;
ssl_certificate_key  /etc/ssl/private/hg.mdpi.intra.key;

root /var/www/hg;

access_log  /var/log/nginx/hg.intra.access.log;
error_log   /var/log/nginx/hg.intra.error.log;

auth_basic 'geeks Source Control';
auth_basic_user_file /var/hg/hgusers.passwd;

location / {
    fastcgi_pass    unix:/var/run/fcgi.sock;
    fastcgi_param   PATH_INFO       $uri;
    fastcgi_param   SCRIPT_FILENAME $request_filename;
    fastcgi_param   QUERY_STRING    $query_string;
    fastcgi_param   REQUEST_METHOD  $request_method;
    fastcgi_param   REQUEST_URI     $request_uri;
    fastcgi_param   CONTENT_TYPE    $content_type;
    fastcgi_param   CONTENT_LENGTH  $content_length;
    fastcgi_param   SERVER_PROTOCOL $server_protocol;
    fastcgi_param   SERVER_PORT     $server_port;
    fastcgi_param   SERVER_NAME     $server_name;
    fastcgi_param   AUTH_USER       $remote_user;
    fastcgi_param   REMOTE_USER     $remote_user;
    fastcgi_param   HTTPS           on;
}

# redirect server error pages to the static page /50x.html
#
error_page   500 502 503 504  /50x.html;
location = /50x.html {
        root   /usr/share/nginx/www;
    }
 }
4

1 回答 1

2

这只是一个猜测,因为我读到你正在使用 nginx 和 cgi?

通常你设置服务器

hgweb.config

或每个存储库

.hg/hgrc

允许推送

[web]
allow_push = *

看看https://www.mercurial-scm.org/wiki/HgWebDirStepByStep?highlight=%28allow_push%29#Allow_pushing_to_the_repository


.hg/hgrc中的本地存储库中,您将需要默认路径和身份验证详细信息来执行 hg 推送。

[paths]
default = <repo-url>

[auth]
devserver.prefix = https://hg.mdpi.com/
devserver.username = <your-name>
devserver.password = <yout-passwd>

我怀疑 hg push https://hg.mdpi.com/会起作用,因为其中没有 repo-name ..

hg 推送https://hg.mdpi.com/reponame

将是合法的。

于 2013-07-27T09:24:51.513 回答