Differences between revisions 3 and 7 (spanning 4 versions)
Revision 3 as of 2008-08-03 20:58:20
Size: 2097
Editor: abuehl
Comment: +cat, some minor fixes
Revision 7 as of 2012-05-13 09:07:58
Size: 2950
Editor: 62
Comment: Cleanup
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
This page describes how to setup the {{{hgwebdir.cgi}}}-skript on a (unix-)server to which you only have ftp-access.
See also HgWebDirStepByStep.
<<Include(A:dated)>>
Line 4: Line 3:
=== Prequesites ===
FTP-access, Python, a cgi-bin directory, but Mercurial not installed on the server.
This page describes how to setup the ''`hgwebdir.cgi`'' script on a Unix server to which you only have FTP access.
See also [[HgWebDirStepByStep]].
Line 7: Line 6:
Consider using a webshell like http://phpshell.sourceforge.net/ {{{#!wiki tip
The multiple repository CGI server is now described [[PublishingRepositories#multiple|in the Publishing Repositories document]] together with other related information. However, this guide gives some additional useful details for publishing repositories.
}}}

{{{#!wiki tip
Starting with version 1.6 of Mercurial, the ''`hgwebdir.cgi`'' script has been unified with the hgweb.cgi script. Wherever ''`hgwebdir.cgi`'' is referred to in these directions, you can substitute the ''`hgweb.cgi`'' script instead.
}}}

=== Prerequisites ===
FTP access, Python, and a ''`cgi-bin`'' directory

Consider using a webshell like [[http://phpshell.sourceforge.net | PHP Shell]]
Line 10: Line 20:
 1. make a directory '/path/to/repos' to which the webserver may write
 2. test whether its writeable
   * by uploading test.sh
 1. Make a directory ''`/path/to/repos`'' to which the webserver may write
 2. Ensure that the directory is writable
   * Upload ''`test.sh`''
Line 17: Line 27:
   to your {{{cgi-bin/}}} and make it executable {{{chmod a+x test.sh}}}.
   * open {{{http://yourdomain/cgi-bin/test.sh}}}, you'll get an server error, but that's okay
   * now there should be a file {{{/path/to/repos/test}}}
   * delete the file and {{{test.sh}}}
 3. upload a recent version of Mercurical to the server (e.g. the whole {{{/usr/local/lib/python2.4/site-packages/mercurial/}}})
 into {{{/path/to/private_python_libs/mercurial}}}. It must be compiled for the architecture of the server (you may try extract precompiled version from Debian).
 4. make a new subdir {{{cgi-bin/hg/}}}
 5. change {{{hgwebdir.cgi}}} locally to load Mercurial on the server:
   to your ''`cgi-bin/`'' and make it executable: '`chmod a+x test.sh`'.
   * Open {{{http://yourdomain/cgi-bin/test.sh}}} - you'll get an server error, but that's okay
   * Now there should be a file ''`/path/to/repos/test`''
   * Delete the file and ''`test.sh`''
 3. Upload a recent version of Mercurial to the server (e.g. the whole ''`/usr/lib/python2.4/site-packages/mercurial/`'')
 into ''`/path/to/private_python_libs/mercurial`''. It must be compiled for the architecture of the server (you may try to [[http://www.g-loaded.eu/2008/01/28/how-to-extract-rpm-or-deb-packages/|extract]] a precompiled version from a deb or rpm). It [[http://marc.info/?l=mercurial&m=121781158716943&w=2|was reported]] that deleting the ''`*.pyc`'' files helped.
 4. Make a new subdir ''`cgi-bin/hg/`''
 5. Change ''`hgwebdir.cgi`'' locally to load Mercurial on the server:
Line 26: Line 36:
# Uncomment to send python tracebacks to the browser if an error occurs:
import cgitb
cgitb.enable()
Line 30: Line 44:
 and upload it into {{{cgi-bin/hg/}}}. Make it executable.
 6. make locally a {{{hgweb.config}}}:
 and upload it into ''`cgi-bin/hg/`''. Make it executable.
 6. Make a ''`hgweb.config`'':
Line 36: Line 50:
 and upload it to {{{cgi-bin/hg/}}}.
 7. upload an existing repository {{{myrep}}} into {{{/path/to/repos/myrep}}}
 and make it writeable by the server.
 8. you should now be able to access it at {{{http://yourdomain/cgi-bin/hg/hgwebdir.cgi}}}
 9. probably you want to change {{{/path/to/repos/myrep/.hg/hgrc}}} to contain something like:
 and upload it to ''`cgi-bin/hg/`''.
 7. Upload an existing repository ''`myrep`'' into ''`/path/to/repos/myrep`''
 and make it writable by the server.
 8. You should now be able to access it at {{{http://yourdomain/cgi-bin/hg/hgwebdir.cgi}}}
 9. You will probably want to change ''`/path/to/repos/myrep/.hg/hgrc`'' to contain something like:

Note:

This page appears to contain material that is no longer relevant. Please help improve this page by updating its content.

This page describes how to setup the hgwebdir.cgi script on a Unix server to which you only have FTP access. See also HgWebDirStepByStep.

The multiple repository CGI server is now described in the Publishing Repositories document together with other related information. However, this guide gives some additional useful details for publishing repositories.

Starting with version 1.6 of Mercurial, the hgwebdir.cgi script has been unified with the hgweb.cgi script. Wherever hgwebdir.cgi is referred to in these directions, you can substitute the hgweb.cgi script instead.

Prerequisites

FTP access, Python, and a cgi-bin directory

Consider using a webshell like PHP Shell

How to do it

  1. Make a directory /path/to/repos to which the webserver may write

  2. Ensure that the directory is writable
    • Upload test.sh

      echo test > /path/to/repos/test

      to your cgi-bin/ and make it executable: 'chmod a+x test.sh'.

    • Open http://yourdomain/cgi-bin/test.sh - you'll get an server error, but that's okay

    • Now there should be a file /path/to/repos/test

    • Delete the file and test.sh

  3. Upload a recent version of Mercurial to the server (e.g. the whole /usr/lib/python2.4/site-packages/mercurial/) into /path/to/private_python_libs/mercurial. It must be compiled for the architecture of the server (you may try to extract a precompiled version from a deb or rpm). It was reported that deleting the *.pyc files helped.

  4. Make a new subdir cgi-bin/hg/

  5. Change hgwebdir.cgi locally to load Mercurial on the server:

    # Uncomment to send python tracebacks to the browser if an error occurs:
    import cgitb
    cgitb.enable()
    
    # adjust python path if not a system-wide install:
    import sys
    sys.path.insert(0, "/path/to/private_python_libs/") #note that this is one dir up from Mercurial

    and upload it into cgi-bin/hg/. Make it executable.

  6. Make a hgweb.config:

    [collections]
    /path/to/repos/ = /path/to/repos/

    and upload it to cgi-bin/hg/.

  7. Upload an existing repository myrep into /path/to/repos/myrep and make it writable by the server.

  8. You should now be able to access it at http://yourdomain/cgi-bin/hg/hgwebdir.cgi

  9. You will probably want to change /path/to/repos/myrep/.hg/hgrc to contain something like:

    [web]
    contact     = John Doe
    description = This my rep
    push_ssl = false
    allow_archive = gz zip bz2
    style = gitweb
    
    #everybody may change it!
    allow_push   = *


CategoryHowTo

HgWebDirStepByStepFtpOnly (last edited 2012-05-13 09:07:58 by 62)