summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--SETUP.md24
-rwxr-xr-xlib/gitolite3/hooks/common/post-receive25
2 files changed, 47 insertions, 2 deletions
diff --git a/SETUP.md b/SETUP.md
index 9f81afe..25b7508 100644
--- a/SETUP.md
+++ b/SETUP.md
@@ -8,9 +8,29 @@ githost: {{githost}}
## Prerequisites
-Install needed packages:
+Gitolite service need to know the public SSH key of its administrator.
+You can let it ask during install,
+but it may be more convenient to preconfigure that information instead.
- sudo apt install git git-daemon-sysvinit cgit cmark highlight
+One way to preconfigure the needed SSH public key
+is to run this command
+**from your personal system**
+which then **logs into the server system** using ssh
+(adapt to replace ed25519 if your SSH keypair use a different algorithm):
+
+ printf 'gitolite3 gitolite3/adminkey select "%q"' $(cat ~/.ssh/id_ed25519.pub) | ssh {{githost}} sudo debconf-set-selections
+
+Another way is to somehow locate your public SSH key
+and run this command
+(adapt to replace $YOURKEY with your actual key):
+
+ echo gitolite3 gitolite3/adminkey select "$YOURKEY" | sudo debconf-set-selections
+
+Then preconfigure git user,
+and install needed packages:
+
+ echo gitolite3 gitolite3/gituser select git | sudo debconf-set-selections
+ sudo apt install gitolite3 git-daemon-sysvinit cgit cmark highlight
## Configure git access
diff --git a/lib/gitolite3/hooks/common/post-receive b/lib/gitolite3/hooks/common/post-receive
new file mode 100755
index 0000000..9342075
--- /dev/null
+++ b/lib/gitolite3/hooks/common/post-receive
@@ -0,0 +1,25 @@
+#!/bin/sh
+# This gitolite3 hook exports content for web publishing.
+
+# The following gitolite3 environment variables affect its use:
+# WEB_BRANCH tree-ish (hook silently skipped if unset)
+# WEB_BASEDIR path writable by gitolite3 (default: /var/www/gitolite3)
+
+set -eu
+
+[ -n "$GL_OPTION_WEB_BRANCH" ] || exit 0
+
+# which git branch to check out
+WEB_BASEDIR=${GL_OPTION_WEB_BASEDIR:-/var/www/gitolite3}
+
+GIT_WORK_TREE="$WEB_BASEDIR/$GL_REPO"
+export GIT_WORK_TREE
+
+pwd
+echo "Checking out content to $GIT_WORK_TREE ..."
+
+git checkout -f "$GL_OPTION_WEB_BRANCH"
+
+chmod -R u=rw,go=r,a+X "$GIT_WORK_TREE"
+
+echo "Checkout completed succesfully!"