Error "fatal: detected dubious ownership in repository" in Bitbucket Cloud pipelines
Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.
Summary
The error message "fatal: detected dubious ownership in the repository" typically indicates a problem with the ownership or permissions of some files or directories within your Git repository. This can happen when Git detects inconsistencies in ownership information between different files or directories.
Solution
Add a line in the bitbucket-pipelines.yml to check the current user that is running the build step. If this is not the root user - either change to root or ensure write permissions are present for the current user.
1
whoami
You can try adding the following lines to your bitbucket-pipelines.yml to either change ownership of the build directory to the current user or add an exception for the build directory.
1 2
chown -R <username> /opt/atlassian/pipelines/agent/build git config --global --add safe.directory /opt/atlassian/pipelines/agent/build
Was this helpful?