coreos-home-server/config/service/git/container/run-git-server
Alex Palaistras 576ded0eee git: Add static site generation, read-only access
This commit extends the pre-existing `git` service with static HTML
generation for public repositories (i.e. repositories placed under the
`public` directory), which can then be served via existing mechanisms.

In support of these changes, public repositories can be made available
for cloning via the `git://` protocol, which listens on port 9418 by
default. Only public repositories will be considered, and user access
has been set up to ensure that private repositories are not made
accessible by accident.
2021-12-06 11:58:01 +00:00

25 lines
673 B
Bash
Executable File

#!/bin/sh
# Generate host keys if none were found.
for t in rsa ecdsa ed25519; do
if test ! -f /etc/ssh/keys/ssh_host_${t}_key; then
ssh-keygen -q -t $t -f /etc/ssh/keys/ssh_host_${t}_key -C '' -N '' > /dev/null
fi
done
# Create any missing directories.
mkdir -p /var/lib/git/.ssh /var/lib/git/public
# Correct permissions where needed.
chown -R git:git /var/lib/git /var/lib/git-serve
chown -R git-public:git /var/lib/git/public
chmod -R u+rwX,go-rwxX /var/lib/git && chmod g+X /var/lib/git
chmod -R ug+rwX /var/lib/git/public
chmod 0644 /etc/ssh/keys/ssh_host_*_key.pub
chmod 0600 /etc/ssh/keys/ssh_host_*_key
# Run SSH daemon.
/usr/sbin/sshd -D -e