meta data for this page
This is an old revision of the document!
safe.directory
Symptoms
fatal: detected dubious ownership in repository at
fatal: unsafe repository ('/builds/rPrca3qv/0/group/project' is owned by someone else) To add an exception for this directory, call: git config --global --add safe.directory /builds/rPrca3qv/0/group/project
Source of problem
Workaround
Workaround for Yocto
Fix in Poky: bitbake.conf: mark all directories as safe for git to read
This variable can be added to local.conf
, but it invalidates whole sstate. Simple solution is to fix one recipe:
do_compile_prepend() { git config --global --add safe.directory ${S} }
Workaround for Gitlab CI
git config --global --add safe.directory ${CI_PROJECT_DIR} # and if needed, for some submodules git config --global --add safe.directory ${CI_PROJECT_DIR}/bootloader
Workarounds:
Best workaround: https://gitlab.com/gitlab-org/gitlab-runner/-/issues/29022#note_1356788508
- config.toml
[[runners]] environment = ["GIT_CONFIG_COUNT=1", "GIT_CONFIG_KEY_0=safe.directory", "GIT_CONFIG_VALUE_0=*", "GIT_CONFIG_PARAMETERS='safe.directory=*'"]
or re-register runner with args:
gitlab-runner register \ --env "GIT_CONFIG_COUNT=1" \ --env "GIT_CONFIG_KEY_0=safe.directory" \ --env "GIT_CONFIG_VALUE_0=*" \ --env "GIT_CONFIG_PARAMETERS="'safe.directory=*'"
Note: According to bitbake.conf: mark all directories as safe for git to read :
This can be set globally via the internal environment variable GIT_CONFIG_PARAMETERS, we can't use GIT_CONFIG_*_KEY/VALUE as that isn't present in all the releases which have the ownership check.