diff options
-rw-r--r-- | doc/tips/setup_a_public_repository_on_a_web_site.mdwn | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/doc/tips/setup_a_public_repository_on_a_web_site.mdwn b/doc/tips/setup_a_public_repository_on_a_web_site.mdwn index e1fbd1e47..39b291218 100644 --- a/doc/tips/setup_a_public_repository_on_a_web_site.mdwn +++ b/doc/tips/setup_a_public_repository_on_a_web_site.mdwn @@ -20,12 +20,34 @@ Here's how I set it up. --[[Joey]] 7. Instruct advanced users to clone a http url that ends with the "/.git/" directory. For example, for downloads.kitenet.net, the clone url is `https://downloads.kitenet.net/.git/` -8. Set up a git `post-receive` hook that runs `git annex merge`, and - the repository's working tree will automatically be updated when - you run `git annex sync` in a clone that can push to the repository. - (Needs git-annex version 4.20130703 or newer; older versions - can use `git annex sync` in the post-receive hook instead.) +8. Set up a git `post-receive` hook to update the repository's working tree + when changes are pushed to it. See below for details. When users clone over http, and run git-annex, it will automatically learn all about your repository and be able to download files right out of it, also using http. + +## post-receive hook + +If you have git-annex 4.20130703, the post-receive hook mentioned above +in step 8 just needs to run `git annex merge`. + +With older versions of git-annex, you can instead use `git annex sync`. + +There are two gotchas with some versions of git to be aware of when writing +this post-receive hook. + +1. The hook may be run with the current directory set to the `.git` + directory, and not the top of your work tree. So you need to `cd ..` or + similar in the hook. +2. `GIT_DIR` may be set to `.`, which will not be right after changing + directory. So you will probably want to unset it. + +Here's a post-receive hook that takes these problems into account: + +<pre> +#!/bin/sh +unset GIT_DIR +cd .. +git annex merge +</pre> |