'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.
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
Thank you, for your assistance Patrik, was stuck with this for a while.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thank you so much.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
worked for me. Thank you even if its years later. :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This didn't work for me. I have tried using --global or --system.
I do see the setting set in the corresponding file but git (and sourcetree) still won't let me clone the repository
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just Sourcetree Run as administrator
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The fix for any users running Parallels on their Mac and hitting this error when Cloning to the Windows virtual machine is to change the default download location to their named Windows drive.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.