3 GITEA_HOME=/var/lib/gitea
4 HOST_GIT_USER=git # this will be the user in the ssh git urls, e.g. git@blacka.com/org/repo.git
8 # create the 'git:gitea' user to run and own this thing
9 # Note we want 'git' as the user, since every other git hosting system uses that
10 if ! id -u "$HOST_GIT_UID" >/dev/null 2>&1; then
11 groupadd -g "$HOST_GIT_UID" "$HOST_GIT_GROUP"
12 useradd -u "$HOST_GIT_UID" -g "$HOST_GIT_USER" -G docker -d "$GITEA_HOME" -m "$HOST_GIT_USER"
15 install -d "$GITEA_HOME/data"
17 cat <<"EOF" | sudo tee $GITEA_HOME/docker-shell
19 /usr/bin/docker exec -i -u git --env SSH_ORIGINAL_COMMAND="$SSH_ORIGINAL_COMMAND" gitea sh "$@"
21 sudo chmod +x $GITEA_HOME/docker-shell
22 sudo usermod -s $GITEA_HOME/docker-shell git