stagit-scripts

Static git repository setup scripts
git clone https://www.brianlane.com/git/stagit-scripts
Log | Files | Refs | README

README.md (2526B)


      1 # Self hosting git repositories as static html pages
      2 
      3 The [stagit project](https://codemadness.org/git/stagit/file/README.html)
      4 generates static html pages for your git repositories.  You can even set it up
      5 as a remote so that pushing to it will update the pages and copy them to
      6 wherever you are hosting your domain.
      7 
      8 * Check out `git://git.codemadness.org/stagit` and run make
      9 * Install the binary to a location in your `$PATH`
     10 * Create a top level directory to hold the stagit copy of the repos.  This is called `reposdir` in `setup-stagit-remote`.
     11 * Copy the `*.png` files from the stagit repository to `reposdir` or use your own.
     12 * Copy the `post-receive` script somewhere outside the `stagit-files` repo so that it can be customized.
     13 * Edit the `setup-stagit-remote` script:
     14     * set `reposdir` to the directory you created to hold the repos.
     15     * set `post_receive` to the path of the copy of the script.
     16 * Edit the copy of the `post-receive` script:
     17     * Set BASEURL to where you are serving the git repos from
     18     * `RSYNC_DEST` if you want to use the `rsync` at the end of the file to copy them over
     19     * `reposdir` to match the `reposdir` from setup-stagit-remote
     20     * Check the rsync at the end of the script and replace with your own upload method if needed.
     21 
     22 *WARNING* Do not put sensitive information in the post-receive script, it is uploaded to the html
     23 server as part of the git repository and is exposed to the world.
     24 
     25 The `reposdir` should *not* be the same directory as your normal repos.  It will
     26 contain bare clones of them and only be used to build the html pages and upload
     27 them to your html server.  Multiple repos will be under this directory, with an
     28 `index.html` file pointing to them.
     29 
     30 The `setup-stagit-script` only supports `master` and `main` branches, if you
     31 have named the `master` branch something else edit the script and add it to the
     32 case that currently only matches `origin/main`.
     33 
     34 
     35 # Setup a new repo
     36 
     37 `cd` to the working directory of one of your repos and check out the primary
     38 branch.  Then run `setup-stagit-remote`.  It will prompt you to enter a
     39 description of the project, which will be displayed on the html pages.  It will
     40 then make a bare clone of the repo and add a new remote, named `stagit`, to
     41 your git config for this repo.
     42 
     43 You can now run `git push stagit master` and it will push to the `$reposdir`
     44 repo, run `stagit` on it, and upload it to your html server.
     45 
     46 Now you can visit your webpage, and test cloning one of the repos to make sure
     47 everything is working.