aboutsummaryrefslogtreecommitdiff
path: root/scripts/util/post-receive.sh
diff options
context:
space:
mode:
authorben <ben@nagy.contact>2025-05-03 15:09:20 -0700
committerben <ben@nagy.contact>2025-05-03 15:09:20 -0700
commit564229f11b6a6b86a37379a8c6855f5033ce58a2 (patch)
tree91266a1d94bc8e5d1441d2a9c2f842601ffd57bd /scripts/util/post-receive.sh
parent19d17fd83dcfc0052c39fb8f06c34879473faadc (diff)
remote git scriptsmain
Diffstat (limited to 'scripts/util/post-receive.sh')
-rw-r--r--scripts/util/post-receive.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/scripts/util/post-receive.sh b/scripts/util/post-receive.sh
new file mode 100644
index 0000000..699cce6
--- /dev/null
+++ b/scripts/util/post-receive.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+# this should be on remote server
+
+CONF_FILE="/home/git/public_repos.conf"
+REPO_NAME=$(basename $(pwd) .git)
+PUBLIC_DIR="/var/www/git/$REPO_NAME"
+
+if grep -qx "$REPO_NAME" "$CONF_FILE"; then
+ echo "Syncing $REPO_NAME to public directory..."
+ rsync -a --delete --exclude '.git' /home/git/$REPO_NAME/ "$PUBLIC_DIR/"
+ echo "Public sync complete."
+else
+ echo "$REPO_NAME is not marked as public. No action taken."
+fi