diff options
Diffstat (limited to 'git-server/start.sh')
| -rw-r--r-- | git-server/start.sh | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/git-server/start.sh b/git-server/start.sh index dcfb471..5fbbd58 100644 --- a/git-server/start.sh +++ b/git-server/start.sh @@ -1,8 +1,8 @@ #!/bin/sh -# If there is some public key in keys folder -# then it copies its contain in authorized_keys file -if [ "$(ls -A /git-server/keys/)" ]; then +# 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 @@ -10,14 +10,12 @@ if [ "$(ls -A /git-server/keys/)" ]; then chmod -R 600 .ssh/* fi -# Checking permissions and fixing SGID bit in repos folder -# More info: https://github.com/jkarlosb/git-server-docker/issues/1 -if [ "$(ls -A /repos/)" ]; then - cd /repos - chown -R git:git . - chmod -R ug+rwX . - find . -type d -exec chmod g+s '{}' + -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 |
