-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
Running openapi-changes (v0.0.85) in Docker I found this git-related error:
$ docker run --rm -v $(pwd):/work pb33f/openapi-changes html-report . openapi.yaml
@@@@@@@ @@@@@@@ @@@@@@ @@@@@@ @@@@@@@@
@@@@@@@@ @@@@@@@@ @@@@@@@ @@@@@@@ @@@@@@@@
@@! @@@ @@! @@@ @@@ @@@ @@!
!@! @!@ !@ @!@ @!@ @!@ !@!
@!@@!@! @!@!@!@ @!@!!@ @!@!!@ @!!!:!
!!@!!! !!!@!!!! !!@!@! !!@!@! !!!!!:
!!: !!: !!! !!: !!: !!:
:!: :!: !:! :!: :!: :!:
:: :: :::: :: :::: :: :::: ::
: :: : :: : : : : : : :
🔗 https://pb33f.io/openapi-changes/
------------------------------------
openapi-changes version: latest | compiled: Tue, 29 Jul 2025 10:38:43 UTC
starting work.
ERROR Stopped: cannot extract history received non-zero exit code from git for '.' when running "/usr/bin/git --no-pager log --pretty=%cD||%h||%s||%an||%ae --follow -n 5 -- openapi.yaml" (are you sure it's a git repo?): exit status 128 -- stderr: fatal: detected dubious ownership in repository at '/work'
To add an exception for this directory, call:
git config --global --add safe.directory /work
DONE completed processing
WARNING warnings reported during processing
⚠️ received non-zero exit code from git for '.' when running "/usr/bin/git --no-pager log --pretty=%cD||%h||%s||%an||%ae --follow -n 5 -- openapi.yaml" (are you sure it's a git repo?): exit status 128 -- stderr: fatal: detected dubious ownership in repository at '/work'
To add an exception for this directory, call:
git config --global --add safe.directory /work
Error: received non-zero exit code from git for '.' when running "/usr/bin/git --no-pager log --pretty=%cD||%h||%s||%an||%ae --follow -n 5 -- openapi.yaml" (are you sure it's a git repo?): exit status 128 -- stderr: fatal: detected dubious ownership in repository at '/work'
To add an exception for this directory, call:
git config --global --add safe.directory /work
ERROR received non-zero exit code from git for '.' when running "/usr/bin/git --no-pager log --pretty=%cD||%h||%s||%an||%ae --follow -n 5 -- openapi.yaml" (are you sure it's a git repo?): exit status 128 -- stderr: fatal: detected dubious ownership in repository at '/work'
To add an exception for this directory, call:
git config --global --add safe.directory /workAs a workaround I cloned this repo, I added to the Dockerfile the command RUN git config --global --add safe.directory /work and, using the custom built image, it works.
Here is the Dockerfile I used:
FROM golang:1.23-bookworm as builder
RUN mkdir -p /opt/openapi-changes
WORKDIR /opt/openapi-changes
COPY . ./
RUN go mod download && go mod verify
RUN go build -ldflags="-w -s" -v -o /openapi-changes openapi-changes.go
FROM debian:bookworm-slim
RUN apt-get update
RUN apt-get --yes install git
# ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
RUN git config --global --add safe.directory /work
# ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
WORKDIR /work
COPY --from=0 /openapi-changes /
ENV PATH=$PATH:/
ENTRYPOINT ["openapi-changes"]Metadata
Metadata
Assignees
Labels
No labels