git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Git "safe directory" not working correctly
@ 2024-05-25 18:49 William Ruppel
  2024-05-25 20:22 ` William Ruppel
  0 siblings, 1 reply; 4+ messages in thread
From: William Ruppel @ 2024-05-25 18:49 UTC (permalink / raw)
  To: git

Thank you for filling out a Git bug report!
Please answer the following questions to help us understand your issue.


What did you do before the bug happened? (Steps to reproduce your issue)
Upgraded to git 2.25.1.windows.1
Now when I pull from my remote I get: fatal: detected dubious
ownership in repository at '\\bill\gitmaster\Src'
So, I ran this to whitelist everything: git config --global --add
safe.directory '*'
However, this does NOT solve the issue! I am still getting the same
'dubious ownership' error!
So... what, is this some sort of bug where UNC paths are not being
recognized as safe?? Or...?


What did you expect to happen? (Expected behavior)
Pull should succeed without security errors, since I whilelisted *


What happened instead? (Actual behavior)
git craps out with a 'detected dubious ownership' error.


What's different between what you expected and what actually happened?
I cannot pull changes from my remote!


Anything else you want to add:
Please provide a workaround.


Please review the rest of the bug report below.
You can delete any lines you don't wish to share.


[System Info]
git version:
git version 2.45.1.windows.1
cpu: x86_64
built from commit: 965b16798dab6962ada5b0d8cf0dca68f385c448
sizeof-long: 4
sizeof-size_t: 8
shell-path: /bin/sh
feature: fsmonitor--daemon
uname: Windows 10.0 19045
compiler info: gnuc: 13.2
libc info: no libc information available
$SHELL (typically, interactive shell): <unset>


[Enabled Hooks]
not run from a git repository - no hooks to show

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Git "safe directory" not working correctly
  2024-05-25 18:49 Git "safe directory" not working correctly William Ruppel
@ 2024-05-25 20:22 ` William Ruppel
  2024-05-25 21:38   ` brian m. carlson
  0 siblings, 1 reply; 4+ messages in thread
From: William Ruppel @ 2024-05-25 20:22 UTC (permalink / raw)
  To: git

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?

Thanks.

On Sat, May 25, 2024 at 2:49 PM William Ruppel <wcruppel@gmail.com> wrote:
>
> Thank you for filling out a Git bug report!
> Please answer the following questions to help us understand your issue.
>
>
> What did you do before the bug happened? (Steps to reproduce your issue)
> Upgraded to git 2.25.1.windows.1
> Now when I pull from my remote I get: fatal: detected dubious
> ownership in repository at '\\bill\gitmaster\Src'
> So, I ran this to whitelist everything: git config --global --add
> safe.directory '*'
> However, this does NOT solve the issue! I am still getting the same
> 'dubious ownership' error!
> So... what, is this some sort of bug where UNC paths are not being
> recognized as safe?? Or...?
>
>
> What did you expect to happen? (Expected behavior)
> Pull should succeed without security errors, since I whilelisted *
>
>
> What happened instead? (Actual behavior)
> git craps out with a 'detected dubious ownership' error.
>
>
> What's different between what you expected and what actually happened?
> I cannot pull changes from my remote!
>
>
> Anything else you want to add:
> Please provide a workaround.
>
>
> Please review the rest of the bug report below.
> You can delete any lines you don't wish to share.
>
>
> [System Info]
> git version:
> git version 2.45.1.windows.1
> cpu: x86_64
> built from commit: 965b16798dab6962ada5b0d8cf0dca68f385c448
> sizeof-long: 4
> sizeof-size_t: 8
> shell-path: /bin/sh
> feature: fsmonitor--daemon
> uname: Windows 10.0 19045
> compiler info: gnuc: 13.2
> libc info: no libc information available
> $SHELL (typically, interactive shell): <unset>
>
>
> [Enabled Hooks]
> not run from a git repository - no hooks to show

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Git "safe directory" not working correctly
  2024-05-25 20:22 ` William Ruppel
@ 2024-05-25 21:38   ` brian m. carlson
  2024-05-25 22:11     ` William Ruppel
  0 siblings, 1 reply; 4+ messages in thread
From: brian m. carlson @ 2024-05-25 21:38 UTC (permalink / raw)
  To: William Ruppel; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 1725 bytes --]

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.
-- 
brian m. carlson (they/them or he/him)
Toronto, Ontario, CA

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Git "safe directory" not working correctly
  2024-05-25 21:38   ` brian m. carlson
@ 2024-05-25 22:11     ` William Ruppel
  0 siblings, 0 replies; 4+ messages in thread
From: William Ruppel @ 2024-05-25 22:11 UTC (permalink / raw)
  To: brian m. carlson, git

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-05-25 22:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-25 18:49 Git "safe directory" not working correctly William Ruppel
2024-05-25 20:22 ` William Ruppel
2024-05-25 21:38   ` brian m. carlson
2024-05-25 22:11     ` William Ruppel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).