diff options
| -rw-r--r-- | doc/setup-guide.md | 6 | ||||
| -rw-r--r-- | git-server/Dockerfile | 2 | ||||
| -rw-r--r-- | git-server/sshd_config | 5 |
3 files changed, 7 insertions, 6 deletions
diff --git a/doc/setup-guide.md b/doc/setup-guide.md index 612ca20..1852b34 100644 --- a/doc/setup-guide.md +++ b/doc/setup-guide.md @@ -103,8 +103,8 @@ cd /var/git/repos git init --bare test.git chown -R 1000:1000 test.git # git user inside container -# From a client machine -git clone ssh://git@<server-ip>/repos/test.git +# From a client machine (SCP-style, relative to git user home /repos) +git clone git@<server-ip>:test.git or git clone git://<server-ip>/test.git ``` @@ -278,7 +278,7 @@ All services should now be accessible: | `https://swave.lol/jenkins` | Jenkins (path-based) | | `https://jenkins.swave.lol` | Jenkins (subdomain) | | `http://<server-ip>:9000` | Portainer | -| `ssh://git@<server-ip>/repos/<repo>.git` | Git (SSH) | +| `git@<server-ip>:<repo>.git` | Git (SSH) | | `git://<server-ip>/<repo>.git` | Git (daemon, read-only) | 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 |
