Rollup merge of #127839 - ehuss:safe-directory-docker, r=Mark-Simulacrum

Fix git safe-directory path for docker images

This fixes the path for configuring the git safe.directory setting inside docker images. AFAIK, `~/gitconfig` without a dot is not something that git uses ([ref](https://git-scm.com/docs/git-config)). This was needed in my environment to avoid the ` fatal: detected dubious ownership in repository at '/checkout'` error. For context, this was added in #99967.
This commit is contained in:
Matthias Krüger 2024-07-20 19:28:58 +02:00 committed by GitHub
commit 60f38916da
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -19,7 +19,7 @@ if [ "$NO_CHANGE_USER" = "" ]; then
# already be running with the right user.
#
# For NO_CHANGE_USER done in the small number of Dockerfiles affected.
echo -e '[safe]\n\tdirectory = *' > /home/user/gitconfig
echo -e '[safe]\n\tdirectory = *' > /home/user/.gitconfig
exec su --preserve-environment -c "env PATH=$PATH \"$0\"" user
fi