aboutsummaryrefslogtreecommitdiff
path: root/usr/local/bin/git-wrapper
diff options
context:
space:
mode:
authorAlex Pooley (@zuedev) <zuedev@gmail.com>2026-05-07 17:48:58 +0100
committerAlex Pooley (@zuedev) <zuedev@gmail.com>2026-05-07 17:48:58 +0100
commitf4525524968ad9619ec953e4cb4e9e03f3ed2165 (patch)
tree23da017cb709fe720b5f0090976aee66ada49d64 /usr/local/bin/git-wrapper
parent40714ca370d4a485e0f7db8b36e994928da842df (diff)
downloadgit.zue.dev-f4525524968ad9619ec953e4cb4e9e03f3ed2165.tar
git.zue.dev-f4525524968ad9619ec953e4cb4e9e03f3ed2165.tar.gz
git.zue.dev-f4525524968ad9619ec953e4cb4e9e03f3ed2165.tar.bz2
git.zue.dev-f4525524968ad9619ec953e4cb4e9e03f3ed2165.tar.xz
git.zue.dev-f4525524968ad9619ec953e4cb4e9e03f3ed2165.zip
Add git-wrapper script and update sshd_config for git user
Diffstat (limited to 'usr/local/bin/git-wrapper')
-rw-r--r--usr/local/bin/git-wrapper16
1 files changed, 16 insertions, 0 deletions
diff --git a/usr/local/bin/git-wrapper b/usr/local/bin/git-wrapper
new file mode 100644
index 0000000..b0e45b3
--- /dev/null
+++ b/usr/local/bin/git-wrapper
@@ -0,0 +1,16 @@
+#!/bin/bash
+# Prepend /repositories/ to bare repo paths in git SSH commands
+case "$SSH_ORIGINAL_COMMAND" in
+ git-upload-pack\'*|git-receive-pack\'*|git-upload-archive\'*)
+ cmd="${SSH_ORIGINAL_COMMAND%\'*}"
+ path="${SSH_ORIGINAL_COMMAND##*\'}"
+ path="${path%\'}"
+ # Prepend /repositories/ if not an absolute path
+ [[ "$path" != /* ]] && path="/repositories/$path"
+ exec $cmd "'$path'"
+ ;;
+ *)
+ echo "Invalid command" >&2
+ exit 1
+ ;;
+esac \ No newline at end of file