Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Getting code 128: fatal: detected dubious ownership in repository

AhmedFarazSiddiqui
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 29, 2023

'git status' failed with code 128: fatal: detected dubious ownership in repository 'DIRECTORY PATH'

I have executed the command 
git config --global --add safe.directory 'DIRECTORY PATH'

The repository started working in the terminal, however, I'm still getting the error on Sourcetree UI.

2 answers

1 accepted

5 votes
Answer accepted
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 30, 2023

Hello @AhmedFarazSiddiqui and thank you for reaching out to Atlassian Community!

I would suspect that Sourcetree is running git with a different user than the user you get in the terminal, which is causing the error to persist.

Since the --global flag only applies to the current user, I would suggest trying to use the --system flag with the '*' wildcard that will disable ownership verification for all the users and all the repositories : 

git config --system --add safe.directory '*' # For all users and all repositories

The wildcard '*' is only available for git version > 2.36

Before adding paths/repositories to the exception list, please make sure to understand the security implications of CVE-2022-24765 and setup_git_directory. This error is returned when the user that owns the local repository is different than the user executing the git command. To avoid this, it's strongly recommended for each user have their own clone of the repository. 

More details are available in the following article : 

Thank you, @AhmedFarazSiddiqui !

Patrik S

AhmedFarazSiddiqui
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 31, 2023

Thank you, for your assistance Patrik, was stuck with this for a while. 

Like # people like this
alvigod OP
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 12, 2023

thank you so much.

Like # people like this
2 votes
dorota
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 25, 2024

Just Sourcetree Run as administrator

marcusobrien May 26, 2024

Yes this is the solution in Windows.

 

Suggest an answer

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

Atlassian Community Events