blob: 5fbbd58decf5b6ca64a585134ef55a31aef29e27 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#!/bin/sh
# If there are .pub key files in keys folder
# then copy their contents into authorized_keys
if ls /git-server/keys/*.pub 1>/dev/null 2>&1; then
cd /home/git
cat /git-server/keys/*.pub > .ssh/authorized_keys
chown -R git:git .ssh
chmod 700 .ssh
chmod -R 600 .ssh/*
fi
# Always set correct ownership and permissions on repos folder
# so that git user can read/write repos (including freshly created ones)
cd /repos
chown -R git:git .
chmod -R ug+rwX .
find . -type d -exec chmod g+s '{}' +
# Run git daemon
#systemctl enable --now git.service
runuser -u git -- git daemon --reuseaddr --base-path=/repos --export-all --informative-errors --verbose --detach
# -D flag avoids executing sshd as a daemon
/usr/sbin/sshd -D
|