#! /bin/bash GITEA_HOME=/var/lib/gitea HOST_GIT_USER=git # this will be the user in the ssh git urls, e.g. git@blacka.com/org/repo.git # create the 'gitea' user to run and own this thing if ! id -u 985 >/dev/null 2>&1; then groupadd -g 895 "$HOST_GIT_USER" useradd -u 895 -g "$HOST_GIT_USER" -G docker -d "$GITEA_HOME" -m gitea fi install -d "$GITEA_HOME/data" cat <<"EOF" | sudo tee $GITEA_HOME/docker-shell #!/bin/sh /usr/bin/docker exec -i -u git --env SSH_ORIGINAL_COMMAND="$SSH_ORIGINAL_COMMAND" gitea sh "$@" EOF sudo chmod +x $GITEA_HOME/docker-shell sudo usermod -s $GITEA_HOME/docker-shell git