Home > OS >  Local git repos are not being recognized by git-bash a re-installing windows 10 while new repos are
Local git repos are not being recognized by git-bash a re-installing windows 10 while new repos are

Time:12-13

I am new to git. I was using git bash recently re installd windows 10 into my laptop. But all my local repos which I was using easily using git bash are giving this error (fatal error unsafe repository ('/home/repo' is owned by someone else). which is coz its not able to find .git folder I guess. And if try to do new repo in my local via git bash that is working fine but my old repos are not working.git bash screenshot vscode for same dir.

I tried to re-install git and config'd my credentials but not worked. I need to access my old repos as previously.

CodePudding user response:

If you reinstalled win10, you are now technically using a different user account (i.e. user account SID is different).

And, for security reasons, since git 2.35.2 git does a check if the repository file owner is the same than the current user and prevent using it if different.

So you have to change the files owner and rights in the file explorer to be the current user. The best option if you can! Or you have to add a security exception for each old repository (it's a workaround not the real good solution in your case).

See the doc for adding an exception

The command is the following (if you decide to go this way):

 git config --global --add safe.directory <path to repository>

See also the security announcement where the command is advertised...

  • Related