summaryrefslogtreecommitdiff
path: root/git-wrapper.sh
diff options
context:
space:
mode:
authora73x <[email protected]>2024-08-25 10:04:00 +0100
committera73x <[email protected]>2024-08-25 10:04:00 +0100
commitd9ae1cb433a5fe66c3f64b15e5849d11a87d0c53 (patch)
tree819bb5768f0b159c2747793c6d2dc494634caa4c /git-wrapper.sh
parent01fae90b3d69acb94f76b51eb453037fdf36bbcc (diff)
initial git server in a container
Diffstat (limited to 'git-wrapper.sh')
-rw-r--r--git-wrapper.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/git-wrapper.sh b/git-wrapper.sh
new file mode 100644
index 0000000..21d1b23
--- /dev/null
+++ b/git-wrapper.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+REPO_NAME=$(echo "$SSH_ORIGINAL_COMMAND" | awk '{print $2}' | tr -d "'")
+
+init_repo() {
+ echo "creating repo"
+ mkdir -p ${REPO_NAME}
+ cd ${REPO_NAME} || exit
+ git init --bare --initial-branch=main
+}
+
+if [ ! -d "$REPO_NAME" ]; then
+ captured=$(init_repo)
+fi
+
+exec git-shell -c "$SSH_ORIGINAL_COMMAND"