I am using a new custom Docker image in my pipeline and am receiving the following error in the pipeline:
<span><span>The repository at "/opt/atlassian/pipelines/agent/build/Symfony" does not have the correct ownership and git refuses to use it:</span></span>
fatal: detected dubious ownership in repository at '/opt/atlassian/pipelines/agent/build'
To add an exception for this directory, call:
<span><span> git config --global --add safe.directory /opt/atlassian/pipelines/agent/build</span></span>
<span><span>The repository at "." does not have the correct ownership and git refuses to use it:</span></span>
<span><span>fatal: detected dubious ownership in repository at '/opt/atlassian/pipelines/agent/build'</span></span>
<span><span>To add an exception for this directory, call:</span></span>
<span><span> git config --global --add safe.directory /opt/atlassian/pipelines/agent/build</span></span>
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?