From 6eda3c5f508dd1a7e756a194404c425cfe5cbff6 Mon Sep 17 00:00:00 2001 From: acidvegas Date: Tue, 27 Jun 2023 20:56:21 -0400 Subject: [PATCH] Added a git deployment helper script --- assets/deploy-git | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 assets/deploy-git diff --git a/assets/deploy-git b/assets/deploy-git new file mode 100755 index 0000000..c7a36c2 --- /dev/null +++ b/assets/deploy-git @@ -0,0 +1,13 @@ +#!/bin/sh +# git deployment for stagit - developed by acidvegas (https://git.acid.vegas/stagit) +[ ! $(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 +# wget git-shells-command repo script +chmod +x /srv/git/git-shell-commands/* && chown -R git:git /srv/git/git-shell-commands +usermod -p '*' git +echo -e "[Unit]\nDescription=Start Git Daemon\n\n[Service]\nExecStart=/usr/bin/git daemon --reuseaddr --base-path=/srv/git/ /srv/git/\n\nRestart=always\nRestartSec=500ms\nUser=git\nGroup=git\n\n[Install]\nWantedBy=multi-user.target" > /etc/systemd/system/git-daemon.service +systemctl start git-daemon && systemctl enable git-daemon +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'" \ No newline at end of file