diff options
author | Charlie <root@dev.ws.local> | 2009-10-28 12:38:08 -0600 |
---|---|---|
committer | Charlie <root@dev.ws.local> | 2009-10-28 12:38:08 -0600 |
commit | 4a46bf92e6306458ed0cfc375c71618c648ac85a (patch) | |
tree | ddc1ea744dc63eb1139c919dbf10010d7ac7d62b |
Initial commit
-rwxr-xr-x | install-repos | 23 | ||||
-rwxr-xr-x | pre-receive | 16 |
2 files changed, 39 insertions, 0 deletions
diff --git a/install-repos b/install-repos new file mode 100755 index 0000000..ae10f44 --- /dev/null +++ b/install-repos @@ -0,0 +1,23 @@ +#!/bin/sh -eu +set -eu + +REPOS="/data/git/*.git" +HOOKS="pre-receive" +dir=`dirname $0` +BASE=`realpath $dir` + +for hook in $HOOKS; do + for git in $REPOS; do + if [ -d "$git" ]; then + cd $git + echo `basename $git` + chown -R www:www . + find . -type f -print0 | xargs -0 chmod 660 + find . -type d -print0 | xargs -0 chmod 770 + ln -sf $BASE/$hook hooks/$hook + git config core.sharedRepository=0660 || true + touch git-daemon-export-ok + fi + done +done + diff --git a/pre-receive b/pre-receive new file mode 100755 index 0000000..4232983 --- /dev/null +++ b/pre-receive @@ -0,0 +1,16 @@ +#!/bin/sh -eu +set -eu + +user=`id -un` + +# Check if user is allowed +match=`test -f git-receive-allow && grep -Fx "$user" git-receive-allow || true` +echo $match > /tmp/match.log +if [ -z "$match" ]; then + cat <<EOF >&2 +--- +You're not allowed to push to this repository as $user. +--- +EOF + exit 1 +fi |