Fix 'detected dubious ownership in repository' error in Docker build and run process#4645
Open
ShotaroMuraoka wants to merge 1 commit intophp:masterfrom
Open
Fix 'detected dubious ownership in repository' error in Docker build and run process#4645ShotaroMuraoka wants to merge 1 commit intophp:masterfrom
ShotaroMuraoka wants to merge 1 commit intophp:masterfrom
Conversation
…ct UID/GID in Docker build
cweiske
added a commit
to mogic-le/php-doc-en
that referenced
this pull request
Nov 21, 2025
The current user and group ID are passed passed to the docker build command and the ownership of the cloned directories are changed to them. This gets rid of git's "dubious ownership" error. Without this changes I got an error: > $ make > docker run --rm -v :/var/www/en -w /var/www -u 1000:1000 php/doc-en > configure.php on PHP 8.2.29, libxml 2.9.14 > > fatal: detected dubious ownership in repository at '/var/www/doc-base' > To add an exception for this directory, call: > > git config --global --add safe.directory /var/www/doc-base > doc-base/temp clean up FAILED. > make: *** [Makefile:22: xhtml] Fehler 1 Resolves: php#4645
cweiske
added a commit
to mogic-le/php-doc-en
that referenced
this pull request
Feb 17, 2026
The current user and group ID are passed passed to the docker build command and the ownership of the cloned directories are changed to them. This gets rid of git's "dubious ownership" error. Without this changes I got an error: > $ make > docker run --rm -v :/var/www/en -w /var/www -u 1000:1000 php/doc-en > configure.php on PHP 8.2.29, libxml 2.9.14 > > fatal: detected dubious ownership in repository at '/var/www/doc-base' > To add an exception for this directory, call: > > git config --global --add safe.directory /var/www/doc-base > doc-base/temp clean up FAILED. > make: *** [Makefile:22: xhtml] Fehler 1 Resolves: php#4645
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request solves the problem
fatal: detected dubious ownership in repository at ...when executing the make command. This was solved by passing the UID and GID of the host user as build arguments and adjusting the ownership of the cloned repository in the Dockerfile.Steps to reproduce
Precondition: Ensure that the doc-base and phd repositories are not cloned in directories adjacent to this directory.
Run the following command in the project root directory:
This will trigger the Docker build and run process, which previously resulted in the "detected dubious ownership in repository" error.
Changes
UIDandGIDbuild arguments in the Makefile docker build command./var/www/phdand/var/www/doc-basedirectories.Verification
makecompletes successfully without the dubious ownership error.Note to reviewers
I'm new to contributing to this repo, so please bear with me.
If you have any feedback or suggestions, I'd really appreciate it!