#!/bin/bash # Path to home directory of 'git' user on host GIT_HOME=$HOME # Path to Gitea 'git' home directory mounted on host GITEA_HOME=$GIT_HOME/data/git # Path to 'passthru' script on host PASSTHRU_SCRIPT=$GIT_HOME/passthru while read file; do if [ "$file" == "authorized_keys" ]; then sed "s#/app/gitea/gitea#$PASSTHRU_SCRIPT#g" $GITEA_HOME/.ssh/authorized_keys >$GIT_HOME/.ssh/authorized_keys fi done < <(exec inotifywait -mq -e close_write --format %f $GITEA_HOME/.ssh)