Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error updating changes: unsafe repository ... is owned by someone else

Recently when I open git projects in Android Studio, I receive this error :

Error updating changes: Unsafe repository (`project name` is owned by someone else). To add an exception to this directory, call : git config --global --add safe.directory ...

I know using command line mentioned I can get rid of this, but isn't there any automatic solution?

I have lots of projects and every now and then I face this!

like image 736
AVEbrahimi Avatar asked Apr 20 '26 00:04

AVEbrahimi


1 Answers

Check your Git version first:

git version

If it is the recent 2.35.2 or 2.36, you need to set the safe.directory setting, because of CVE-2022-24765.

git config --global --add safe.directory 'Path/To/Repo'

Or you can disable it, but make sure you understand why it is there in the first place.

like image 135
VonC Avatar answered Apr 21 '26 17:04

VonC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!