Mercurial HG:“hg push”返回中止:HTTP错误500:没有这样的文件或目录

时间:2013-07-26 09:30:35

标签: mercurial repository push hgrc

我正在使用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;
    }
 }

1 个答案:

答案 0 :(得分:2)

这只是猜测,因为我读到你正在使用带有cgi的nginx?

通常您设置服务器

  

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 push。

[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 push https://hg.mdpi.com/reponame

是合法的。