Home > Software design >  Git for windows 2.35.2 can not add exception safe.directory
Git for windows 2.35.2 can not add exception safe.directory

Time:04-13

I am using git version 2.35.2.windows.1 on my win10. My project is stored in my NAS running Ubuntu. I set up an SMB remote disk using samba, and do all necessary work on win10.

After the 2.35 update, i got

fatal: unsafe repository ('//192.168.1.120/sambashare/x' is owned by someone else) To add an exception for this directory, call:

git config --global --add safe.directory //192.168.1.120/sambashare/x

And after i did as instructed, git threw a warning said: warning: encountered old-style '//192.168.1.120/sambashare/x' that should be '%(prefix)//192.168.1.120/x'

I tried to tweak the directory string a little (like changing it to Z://x, Z://192.168.1.120/x, etc.), but that is of no avail.

my git config file looks like: [safe] directory = //192.168.1.120/sambashare/x , and i am not quite sure what to do to fix this problem.

For now, i am doing all my git work via ssh. Thx in advance for any potential solution.

CodePudding user response:

That warning is specific to git-for-windows/git path.c, for any path starting with /

Try instead the UNC path \\192.168.1.120\sambashare\x

Or downgrade Git for Windows (if you really do not want to see this warning), since this message comes from the recent commit 66a6bcf for v2.35.2.windows.1:

mingw: deprecate old-style runtime-prefix handling in interpolate_path()

On Windows, an absolute POSIX path needs to be turned into a Windows one.

We used to interpret paths starting with a single / as relative to the runtime-prefix, but now these need to be prefixed with %(prefix)/.
Let's warn for now, but still handle it.

CodePudding user response:

Is it possible to disable this check in global git config? I don't want to add exceptions for all my git repos.

  • Related