start.sh (935B)
1 #!/bin/sh 2 3 # If there is some public key in keys folder 4 # then it copies its contain in authorized_keys file 5 if [ "$(ls -A /git-server/keys/)" ]; then 6 cd /home/git || return 7 cat /git-server/keys/*.pub > .ssh/authorized_keys 8 chown -R git:git .ssh 9 chmod 700 .ssh 10 chmod -R 600 .ssh/* 11 fi 12 13 # Checking permissions and fixing SGID bit in repos folder 14 # More info: https://github.com/jkarlosb/git-server-docker/issues/1 15 if [ -d /git-server/repos/ ]; then 16 cd /git-server/repos || return 17 chown -R git:git . 18 chmod -R ug+rwX . 19 find . -type d -exec chmod g+s '{}' + 20 fi 21 if [ -d /git-server/public-html/ ]; then 22 cd /git-server/public-html || return 23 cp ../resources/* . || return 24 chown -R git:git . 25 chmod -R ug+rwX . 26 chmod -R o+r . 27 find . -type d -exec chmod g+s '{}' + 28 fi 29 30 /usr/bin/git daemon --reuseaddr --base-path=/git-server/repos/ /git-server/repos/ & 31 32 # -D flag avoids executing sshd as a daemon 33 /usr/sbin/sshd -D