I am using a new custom Docker image in my pipeline and am receiving the following error in the pipeline:
The repository at "/opt/atlassian/pipelines/agent/build/Symfony" does not have the correct ownership and git refuses to use it:
fatal: detected dubious ownership in repository at '/opt/atlassian/pipelines/agent/build'
To add an exception for this directory, call:
git config --global --add safe.directory /opt/atlassian/pipelines/agent/build
The repository at "." does not have the correct ownership and git refuses to use it:
fatal: detected dubious ownership in repository at '/opt/atlassian/pipelines/agent/build'
To add an exception for this directory, call:
git config --global --add safe.directory /opt/atlassian/pipelines/agent/build
The docker image needs to run as a different user instead of as "root" due to requirements for an add-in to the image. The ID of that user is 100, so I have added the "run-as-user" option to my step.
image:
name: name-of-my-image
run-as-user: 100 # found by bashing into my image and running `id`
script:
-|
...
Are there any suggestions on how to fix this, either in the docker image or in the pipeline step?