summaryrefslogtreecommitdiff
path: root/git-wrapper.sh
blob: 21d1b23392ecb8fd3355d1555ec73b3d1a4a59b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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"