rendered paste body#!/bin/shaccess='/usr/local/git/access'repodir='/usr/local/git/repos'user=$1if [ "x" = "x${user}" ]; then echo "No user supplied in authorized_keys" 1>&2 exit 1fiif [ "x${SSH_ORIGINAL_COMMAND}" = "x" ]; then echo "SSH_ORIGINAL_COMMAND must be given" 1>&2 exit 1fiif [ ! -f ${access} ]; then echo "Access control file ${access} does not exist!" 1>&2 exit 1ficommand=`echo ${SSH_ORIGINAL_COMMAND} | cut -d' ' -f1`repo=$(eval echo $(echo ${SSH_ORIGINAL_COMMAND} | cut -d' ' -f2))acctype=''if [ "x${command}" != "xgit-receive-pack" ]; then acctype='[rw]'elif [ "x${command}" != "xgit-upload-pack" ]; then acctype='w'else echo "Unknown command" 1>&2 exit 1fiif ! grep "${user}:${repo}:${acctype}" ${access} > /dev/null; then echo "No access granted for user ${user} to repository ${repo}" 1>&2 exit 1fiif [ ! -d ${repodir}/${repo} ]; then echo "No such repository hosted" 1>&2 exit 1fi${command} ${repodir}/${repo}