summaryrefslogtreecommitdiff
path: root/git-server
diff options
context:
space:
mode:
authorArseney300 <Arseney300@gmail.com>2026-02-20 04:34:37 +0700
committerArseney300 <Arseney300@gmail.com>2026-02-20 04:34:37 +0700
commit4dc3214715b752c49a398b082aa2c961021ddd2d (patch)
tree261e3f2e834613d4bb8a614d939dd460dd2ccd7e /git-server
parentee7d961c638c3baa0ba12b0451fe5104fecc95a9 (diff)
Change git user home to /repos for shorter clone URLsgit-server/home-dir-change
- Set git user home directory to /repos via usermod -d so SCP-style clone URLs resolve relative to it: git clone git@server:test.git -> /repos/test.git - Set AuthorizedKeysFile to absolute path /home/git/.ssh/authorized_keys to keep SSH keys out of the repos volume - Update setup guide with new clone URL syntax Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'git-server')
-rw-r--r--git-server/Dockerfile2
-rw-r--r--git-server/sshd_config5
2 files changed, 4 insertions, 3 deletions
diff --git a/git-server/Dockerfile b/git-server/Dockerfile
index 580c78d..85fd796 100644
--- a/git-server/Dockerfile
+++ b/git-server/Dockerfile
@@ -16,7 +16,7 @@ RUN mkdir /git-server/keys \
# adduser --disabled-password sets '!' which OpenSSH 10.0 treats as locked,
# rejecting even valid pubkey logins. '*' means "no password login possible"
# but the account is not locked.
- && usermod -p '*' git \
+ && usermod -p '*' -d /repos git \
# git-shell must be in /etc/shells or OpenSSH rejects login
&& echo /usr/bin/git-shell >> /etc/shells \
&& mkdir /home/git/.ssh
diff --git a/git-server/sshd_config b/git-server/sshd_config
index 102169d..d982b37 100644
--- a/git-server/sshd_config
+++ b/git-server/sshd_config
@@ -51,8 +51,9 @@ PubkeyAuthentication yes
# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
-AuthorizedKeysFile .ssh/authorized_keys
-#AuthorizedKeysFile /home/git/.ssh/authorized_keys
+# Absolute path because git user home is /repos (for shorter clone URLs),
+# but .ssh stays at /home/git/.ssh/ to keep it out of the repos volume
+AuthorizedKeysFile /home/git/.ssh/authorized_keys
#AuthorizedPrincipalsFile none