summaryrefslogtreecommitdiff
path: root/check-receive-policy
diff options
context:
space:
mode:
Diffstat (limited to 'check-receive-policy')
-rwxr-xr-xcheck-receive-policy15
1 files changed, 15 insertions, 0 deletions
diff --git a/check-receive-policy b/check-receive-policy
new file mode 100755
index 0000000..1956a07
--- /dev/null
+++ b/check-receive-policy
@@ -0,0 +1,15 @@
+#!/bin/sh -eu
+set -eu
+
+# Check if user is allowed
+user=`id -un`
+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