From f4525524968ad9619ec953e4cb4e9e03f3ed2165 Mon Sep 17 00:00:00 2001 From: "Alex Pooley (@zuedev)" Date: Thu, 7 May 2026 17:48:58 +0100 Subject: Add git-wrapper script and update sshd_config for git user --- usr/local/bin/git-wrapper | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 usr/local/bin/git-wrapper (limited to 'usr/local/bin') 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 -- cgit v1.2.3