summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xaddrepo37
-rw-r--r--cgitrc2
-rw-r--r--gitserver.conf8
3 files changed, 39 insertions, 8 deletions
diff --git a/addrepo b/addrepo
index 1a3aa6a..0ee2495 100755
--- a/addrepo
+++ b/addrepo
@@ -2,12 +2,33 @@
set -e
-for repo in "$@"; do
- mkdir -p /data/git/"$repo".git
- cd /data/git/"$repo".git
- git init --bare
- git config http.receivepack true
- printf "Enter repository description: "
- read -r desc
- echo "$desc" > description
+if [ $# -ne 1 ]; then
+ echo "usage: $0 REPOSITORY"
+ exit 1
+fi
+
+repo="$1"
+
+printf "Enter repository description: "
+read -r desc
+repotype=
+while [ "$repotype" != public -a "$repotype" != private ]; do
+ printf "Type of repository [public/private]: "
+ read -r repotype
done
+
+cd /data/git
+if [ "$repotype" = "private" ]; then
+ mkdir -p private
+ cd private
+fi
+
+mkdir -p "$repo".git
+cd "$repo".git
+git init --bare
+git config http.receivepack true
+echo "$desc" > description
+
+if [ "$repotype" = public ]; then
+ touch EXPORT_OK
+fi
diff --git a/cgitrc b/cgitrc
index ca741ab..2d7f008 100644
--- a/cgitrc
+++ b/cgitrc
@@ -28,5 +28,7 @@ readme=:readme
about-filter=pandoc-filter
owner-filter=/bin/true
+strict-export=EXPORT_OK
+
# must come last
scan-path=/data/git
diff --git a/gitserver.conf b/gitserver.conf
index 0ed4850..c230ed3 100644
--- a/gitserver.conf
+++ b/gitserver.conf
@@ -31,6 +31,14 @@ ScriptAliasMatch \
AuthUserFile /data/.htpasswd
Require valid-user
</LocationMatch>
+# private repositories
+<LocationMatch "^/private/.*$">
+ Order Deny,Allow
+ AuthType Basic
+ AuthName "Git Access"
+ AuthUserFile /data/.htpasswd
+ Require valid-user
+</LocationMatch>
########################################################################
# cgit