summaryrefslogtreecommitdiff
path: root/git-server/start.sh
diff options
context:
space:
mode:
authorArseney300 <Arseney300@gmail.com>2026-02-20 01:34:23 +0700
committerArseney300 <Arseney300@gmail.com>2026-02-20 01:34:23 +0700
commitd8b4a8e4b54e7bec9a955639c8f9dd2ce1daf5ee (patch)
tree4cd5a07a654dcbb400f308902a7043ace92182f1 /git-server/start.sh
Initial commit: bastion server project
Add Docker configurations for Ghost, Git server, and Nginx services with documentation and architecture diagrams. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'git-server/start.sh')
-rw-r--r--git-server/start.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/git-server/start.sh b/git-server/start.sh
new file mode 100644
index 0000000..dcfb471
--- /dev/null
+++ b/git-server/start.sh
@@ -0,0 +1,27 @@
+#!/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
+ cd /home/git
+ cat /git-server/keys/*.pub > .ssh/authorized_keys
+ chown -R git:git .ssh
+ chmod 700 .ssh
+ 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
+
+# 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