Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix git unsafe directory #883

Merged
merged 2 commits into from Jun 2, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 2 additions & 10 deletions Dockerfile
Expand Up @@ -4,21 +4,13 @@ COPY . .
RUN VERSION=$(git describe --tags --abbrev=0) && \
CGO_ENABLED=0 go build -o bin/gitleaks -ldflags "-X="github.com/zricethezav/gitleaks/v8/cmd.Version=${VERSION}

FROM alpine:3.15.4
FROM alpine:3.16
RUN adduser -D gitleaks && \
apk add --no-cache bash git openssh-client
COPY --from=build /go/src/github.com/zricethezav/gitleaks/bin/* /usr/bin/
USER gitleaks

# default to avoid the follow error:
# 11:09PM ERR fatal: unsafe repository ('/path' is owned by someone else)
# 11:09PM ERR To add an exception for this directory, call:
# 11:09PM ERR
# 11:09PM ERR git config --global --add safe.directory /path
# This means that when you run gitleaks from docker you must mount to /path
# in order to avoid this error.

# TODO waiting to push this until I've thought a bit more about it
electriquo marked this conversation as resolved.
Show resolved Hide resolved
electriquo marked this conversation as resolved.
Show resolved Hide resolved
# RUN git config --global --add safe.directory /path
RUN git config --global --add safe.directory '*'

ENTRYPOINT ["gitleaks"]