Milos Cuculovic
Milos Cuculovic

Reputation: 20223

Mercurial HG: "hg push" returns abort: HTTP Error 500: No such file or directory

I am using mercurial and when I am trying to use hg push, I am getting this error:

abort: HTTP Error 500: No such file or directory

Server information:

Any idea why? The pull works fine.

EDIT: By enabling to push with http, I am able to see a stack trace: error.html

EDIT2: However, if I disable the possibility to use http, the initial error comes back.

EDIT3: Here is the error when I am doing the trackback:

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

EDIT 4: The repos hgrc file that is placed in /usr/mercurial looks like that:

[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 error log:

Here is the error log on ngnix side when I am trying to do the push:

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: Here is the repos ngnix settings:

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;
    }
 }

Upvotes: 2

Views: 4088

Answers (1)

cinhtau
cinhtau

Reputation: 1042

This is only a guess, cause I read you are using nginx with cgi?

Usually you setup the server

hgweb.config

or each repository

.hg/hgrc

to allow push

[web]
allow_push = *

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


On your local repository in .hg/hgrc you will need a default path and the authentication details to perform hg push.

[paths]
default = <repo-url>

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

I doubt that hg push https://hg.mdpi.com/ will work, cause there is no repo-name in it ..

hg push https://hg.mdpi.com/reponame

would be legit.

Upvotes: 2

Related Questions