git icon indicating copy to clipboard operation
git copied to clipboard

fatal: detected dubious ownership in repository at '/git'

Open josejsarmento opened this issue 2 years ago • 1 comments

In a local git repo, I enter:

docker run -ti --rm -v ${HOME}:/root -v $(pwd):/git alpine/git status

and it gives me the following error:

docker run -ti --rm -v ${HOME}:/root -v $(pwd):/git alpine/git status
fatal: detected dubious ownership in repository at '/git'
To add an exception for this directory, call:

	git config --global --add safe.directory /git

josejsarmento avatar Nov 24 '22 16:11 josejsarmento

A proposed 'fix' is passing -u $UID:$GID to the docker run commands. It could be relevant to include this in the README.

josejsarmento avatar Nov 24 '22 16:11 josejsarmento

suggested change in https://github.com/alpine-docker/git/pull/55

rmie avatar Feb 08 '23 09:02 rmie

can't duplicate the issue now

$ docker run -ti --rm -v ${HOME}:/root -v $(pwd):/git alpine/git status

Digest: sha256:df3f712d8f82a4e6a408636dc52f1b52fc23e8f2d9f73a271a050961819daf95
Status: Downloaded newer image for alpine/git:latest
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

ozbillwang avatar Jun 13 '23 13:06 ozbillwang