Re: Git "safe directory" not working correctly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks Brian, makes perfect sense. Yes, I was using good ol' Windows cmd.exe. So, there is no bug here.

On 05/25/2024 5:38 PM, brian m. carlson wrote:
On 2024-05-25 at 20:22:38, William Ruppel wrote:
FYI, I discovered that the issue appears to be related to the single
quotes. If I do this instead, then all repos are considered safe:

git config --global --add safe.directory *

And in a similar vein, to whitelist just the single repo I was having
an issue with, git itself  says the command should be:

"
To add an exception for this directory, call:
         git config --global --add safe.directory '\\bill\gitmaster\Src'
"

But, again, the single quotes don't allow this to work.

All the examples I've seen use single quotes. Has something regressed
w.r.t. to how single quotes are handled?
The examples are given for a POSIX shell, where single quotes prevent
any interpolation or escaping, and double quotes permit interpolation.
You're running on Windows, probably with CMD or PowerShell, where single
quotes don't work and would probably be interpreted as part of the
argument, leading to the `safe.directory` value being `'*'`, not `*`.

Note that at a POSIX shell, not quoting the asterisk will result in it
being expanded to all files in the current directory, which is why
quoting is necessary.

If you use Git Bash, then using single quotes is correct.  Otherwise,
you may need to use double quotes or read the documentation for your
shell to determine how to properly quote things.  (I don't use Windows,
so I can't say what the proper syntax is.)  Git itself doesn't
necessarily know what the shell used to invoke it is (very especially on
Windows, where SHELL will not be set), so it provides the default POSIX
command.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux