summaryrefslogtreecommitdiff
path: root/doc/tips/setup_a_public_repository_on_a_web_site.mdwn
diff options
context:
space:
mode:
Diffstat (limited to 'doc/tips/setup_a_public_repository_on_a_web_site.mdwn')
-rw-r--r--doc/tips/setup_a_public_repository_on_a_web_site.mdwn44
1 files changed, 34 insertions, 10 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..8251cabf6 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
@@ -9,23 +9,47 @@ Here's how I set it up. --[[Joey]]
1. Set up a web site. I used Apache, and configured it to follow symlinks.
`Options FollowSymLinks`
2. Put some files on the website. Make sure it works.
-4. `git init; git annex init`
-3. We want users to be able to clone the git repository over http, because
+3. `git init; git annex init`
+4. `git config core.sharedrepository world` (Makes sure files
+ are always added with permissions that allow everyone to read them.)
+5. We want users to be able to clone the git repository over http, because
git-annex can download files from it over http as well. For this to
work, `git update-server-info` needs to get run after commits. The
git `post-update` hook will take care of this, you just need to enable
the hook. `chmod +x .git/hooks/post-update`
-5. `git annex add; git commit -m added`
-6. Make sure users can still download files from the site directly.
-7. Instruct advanced users to clone a http url that ends with the "/.git/"
+6. `git annex add; git commit -m added`
+7. Make sure users can still download files from the site directly.
+8. 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.)
+9. 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>