From 750e20e6dae4472cfd9d7aedf4b44723d7eee90a Mon Sep 17 00:00:00 2001 From: Tim Hockin Date: Sun, 9 Jun 2024 00:34:26 -0700 Subject: [PATCH] Set git `safe.directory` in tool containers Otherwise it hit the "dubious ownership" case. --- _test_tools/httpd/Dockerfile | 2 ++ _test_tools/sshd/Dockerfile | 2 ++ 2 files changed, 4 insertions(+) diff --git a/_test_tools/httpd/Dockerfile b/_test_tools/httpd/Dockerfile index 2838d4948..f0473331d 100644 --- a/_test_tools/httpd/Dockerfile +++ b/_test_tools/httpd/Dockerfile @@ -42,6 +42,8 @@ RUN htpasswd -b -c /etc/htpasswd testuser testpass # Callers should mount a directory with git repos here. VOLUME /git +# sshd runs as root, and the repo directory might be owned by anyone. +RUN git config --system safe.directory '*' COPY nginx.conf /etc/nginx/ COPY run.sh / diff --git a/_test_tools/sshd/Dockerfile b/_test_tools/sshd/Dockerfile index 9b05b1d0e..c8caa682c 100644 --- a/_test_tools/sshd/Dockerfile +++ b/_test_tools/sshd/Dockerfile @@ -49,6 +49,8 @@ VOLUME /dot_ssh # Callers should mount a directory with git repos here. VOLUME /git +# sshd runs as root, and the repo directory might be owned by anyone. +RUN git config --system safe.directory '*' # Callers can SSH as user "test" RUN echo "test:x:65533:65533::/home/test:/usr/bin/git-shell" >> /etc/passwd