forked from opensafely-core/git-server-proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
28 lines (23 loc) · 947 Bytes
/
start.sh
File metadata and controls
28 lines (23 loc) · 947 Bytes
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
26
27
28
#!/bin/sh
# Copy all public keys (if any) to the authorized_keys file.
if [ "$(ls -A /git-server/read-only-keys/)" ]; then
cat /git-server/read-only-keys/*.pub > /home/git-read-only/.ssh/authorized_keys
fi
if [ "$(ls -A /git-server/read-write-keys/)" ]; then
cat /git-server/read-write-keys/*.pub > /home/git-read-write/.ssh/authorized_keys
fi
# Copy the master user key to the correct place
mkdir -p /root/.ssh
cp /git-server/master-key/id_rsa /root/.ssh/id_rsa
chmod -R 700 /root/.ssh
# Check permissions and fix-up the SGID bit in the repos folder.
# More info: https://github.com/jkarlosb/git-server-docker/issues/1
if [ "$(ls -A /git-server/repos/)" ]; then
cd /git-server/repos
chown -R git-read-write:git .
chmod -R ug+rX *
find . -type d -exec chmod g+s '{}' +
fi
# Start the ssh server in the foreground, *not* as a daemon
(set -x ; /usr/sbin/sshd -D) ||
echo 1>&2 "The ssh server has failed unexpectedly; exit code: $?"