Bitbucket Pipelines dubious ownership error

Ive started getting the "detected dubious ownership in repository" Error when I have a pipeline push commits to my repo. The push is successful, but subsequent pipelines on the commit fail

/usr/bin/git exited with 128: 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

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Nov 15, 2022

Hi Nabil,

Does this error show in the output of a command that is running during the build?

This error shows by Git due to a change introduced in Git 2.35.2 (and newer) to prevent a user from executing git commands in a repository owned by a different user.

The user who owns the files in the build container is root by default. If you are running Git commands with a different user, this error will show mentioning that the directory is owned by another user.

You can add an exception for the clone directory by adding the following command in the script of your bitbucket-pipelines.yml file prior to the command that gives the error:

git config --global --add safe.directory /opt/atlassian/pipelines/agent/build

You can find more details on this knowledge base article we have:

Please feel free to let me know if this works for you and if you need further assistance.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events