tools/deploy/deploy-git

11 lines
845 B
Bash
Executable File

#!/bin/sh
# SuperNETs tool for git deployment - Developed by acidvegas (https://git.acid.vegas/supertools)
[ ! $(grep -q /usr/bin/git-shell /etc/shells) ] && echo "/usr/bin/git-shell" >> /etc/shells
[ ! $(getent passwd git) ] && userdel -f git
useradd -d /srv/git -k /dev/null -m -s /usr/bin/git-shell -U git
mkdir -p /srv/git/git-shell-commands
echo -e "#!/bin/sh\nmkdir $1.git\ngit init --bare $1" > /srv/git/git-shell-commands/add
echo -e "#!/bin/sh\nrm -rf $1" > /srv/git/git-shell-commands/del
chmod +x /srv/git/git-shell-commands/* && chown -R git:git /srv/git/git-shell-commands
echo "Be sure to use 'AuthorizedKeysFile /etc/ssh/authorized_keys/%u' in your /etc/ssh/sshd_config"
echo "Add your public key to /etc/ssh/authorized_keys/git prefixed with 'no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty'"