stagit/assets/deploy-git

33 lines
1.4 KiB
Plaintext
Raw Normal View History

2023-06-28 00:56:21 +00:00
#!/bin/sh
2023-11-27 04:20:03 +00:00
apt-get install -y git
2023-06-28 00:56:21 +00:00
[ ! $(grep -q /usr/bin/git-shell /etc/shells) ] && echo "/usr/bin/git-shell" >> /etc/shells
[ ! $(getent passwd git) ] && userdel -f git
2023-11-27 04:20:03 +00:00
2023-06-28 00:56:21 +00:00
useradd -d /srv/git -k /dev/null -m -s /usr/bin/git-shell -U git
2023-11-27 04:20:03 +00:00
mkdir -p /srv/git/git-shell-commands && wget -O /srv/git/git-shell-commands https://raw.githubusercontent.com/acidvegas/stagit/master/assets/repo
2023-06-28 00:56:21 +00:00
chmod +x /srv/git/git-shell-commands/* && chown -R git:git /srv/git/git-shell-commands
2023-11-27 04:20:03 +00:00
2023-06-28 00:56:21 +00:00
usermod -p '*' git
2023-11-27 04:20:03 +00:00
printf "[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\n" > /etc/systemd/system/git-daemon.service
2023-06-28 00:56:21 +00:00
systemctl start git-daemon && systemctl enable git-daemon
2023-11-27 04:20:03 +00:00
2023-06-28 00:56:21 +00:00
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'"
2023-11-27 04:20:03 +00:00
apt-get install libmd4c-dev libmd4c-html0 libmd4c-html0-dev libmd4c0
apt-get install libgit2-dev
certbot --nginx -d example.com -d www.example.com
git config --system init.defaultBranch main # <- THIS MOTHER FUCKER
# Not finished yet
git clone https://github.com/acidvegas/stagit
#STAGIT_CFLAGS += -DGIT_OPT_SET_OWNER_VALIDATION=-1
Makefile uncomment