mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-31 11:17:20 +02:00
Merge branch 'feature/docker_git_safe_dirs_v5.0' into 'release/v5.0'
feat(docker): allow to add dirs into git's safe.directory (v5.0) See merge request espressif/esp-idf!27561
This commit is contained in:
@@ -60,6 +60,10 @@ The above command explained:
|
|||||||
- ``espressif/idf``: uses Docker image ``espressif/idf`` with tag ``latest`` (implicitly added by Docker when no tag is specified)
|
- ``espressif/idf``: uses Docker image ``espressif/idf`` with tag ``latest`` (implicitly added by Docker when no tag is specified)
|
||||||
- ``idf.py build``: runs this command inside the container
|
- ``idf.py build``: runs this command inside the container
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
When the mounted directory, ``/project``, contains a git repository owned by a different user (``UID``) than the one running the Docker container, git commands executed within ``/project`` might fail, displaying an error message ``fatal: detected dubious ownership in repository at '/project'``. To resolve this issue, you can designate the ``/project`` directory as safe by setting the IDF_GIT_SAFE_DIR environment variable during the Docker container startup. For instance, you can achieve this by including ``-e IDF_GIT_SAFE_DIR='/project'`` as a parameter. Additionally, multiple directories can be specified by using a ``:`` separator. To entirely disable this git security check, ``*`` can be used.
|
||||||
|
|
||||||
To build with a specific docker image tag, specify it as ``espressif/idf:TAG``, for example::
|
To build with a specific docker image tag, specify it as ``espressif/idf:TAG``, for example::
|
||||||
|
|
||||||
docker run --rm -v $PWD:/project -w /project espressif/idf:release-v4.4 idf.py build
|
docker run --rm -v $PWD:/project -w /project espressif/idf:release-v4.4 idf.py build
|
||||||
|
@@ -1,6 +1,20 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# IDF_GIT_SAFE_DIR has the same format as system PATH environment variable.
|
||||||
|
# All path specified in IDF_GIT_SAFE_DIR will be added to user's
|
||||||
|
# global git config as safe.directory paths. For more information
|
||||||
|
# see git-config manual page.
|
||||||
|
if [ -n "${IDF_GIT_SAFE_DIR+x}" ]
|
||||||
|
then
|
||||||
|
echo "Adding following directories into git's safe.directory"
|
||||||
|
echo "$IDF_GIT_SAFE_DIR" | tr ':' '\n' | while read -r dir
|
||||||
|
do
|
||||||
|
git config --global --add safe.directory "$dir"
|
||||||
|
echo " $dir"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
. $IDF_PATH/export.sh
|
. $IDF_PATH/export.sh
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
Reference in New Issue
Block a user