git-for-windows / git

A fork of Git containing Windows-specific patches.
http://gitforwindows.org/
Other
8.19k stars 2.49k forks source link

git fsck not working on private network path, safe directory is set with parent path #4944

Closed Xargas closed 1 month ago

Xargas commented 1 month ago

Setup

$ git --version --build-options

git version 2.45.0.windows.1
cpu: x86_64
built from commit: b5d0511969ccd9ab86395c37e5a7619d8b4e7c32
sizeof-long: 4
sizeof-size_t: 8
shell-path: /bin/sh
feature: fsmonitor--daemon
$ cmd.exe /c ver

Microsoft Windows [Version 10.0.22631.3447]
Editor Option: VIM
Custom Editor Path:
Default Branch Option:
Path Option: CmdTools
SSH Option: OpenSSH
Tortoise Option: false
CURL Option: OpenSSL
CRLF Option: CRLFCommitAsIs
Bash Terminal Option: MinTTY
Git Pull Behavior Option: Merge
Use Credential Manager: Disabled
Performance Tweaks FSCache: Disabled
Enable Symlinks: Disabled
Enable Pseudo Console Support: Disabled
Enable FSMonitor: Disabled
Using Beyond Compare for diff, all other settings are default.
I think this should not be related

Details

git fsck --progress fatal: detected dubious ownership in repository at '//192.168.0.2/repositories/app1.git' '//192.168.0.2/repositories/app1.git' is owned by: (inconvertible) (S-X-X-XX-XXXYYYZZZZ-XXXXYYYZZZ-XXXXYYYYZZ-XXXX) but the current user is: DESKTOP/Xargas (S-Z-Z-ZZ-ZZZYYYZZZZ-ZZZZYYYZZZ-XXXXYYYYZZ-XXXX) To add an exception for this directory, call:

    git config --global --add safe.directory '%(prefix)///192.168.0.2/repositories/app1.git'

 - What did you expect to occur after running these commands?

Running the git file system check as usual, as the global git config contains the line for the safe directory, specifying the parent directory as safe, so all sub directories should be accepted as safe git repositories. [safe] directory = %(prefix)///192.168.0.2/*


 - What actually happened instead?

Error message as above. No file system check

 - If the problem was occurring with a specific repository, can you provide the
   URL to that repository to help us with testing?

Repository is on a private network. There I have a folder where only I have access. I use it to automatically backup repository data. (nightly, weekly, monthly)

rimrul commented 1 month ago

There is no pattern matching in safe.directory. There is only * and explicit names.

dscho commented 1 month ago

See also https://git-scm.com/docs/git-config#Documentation/git-config.txt-safedirectory.

Besides, this is not a Windows-specific issue. @Xargas if you feel that this should be changed, please take it to the Git mailing list (send plain-text messages, HTML messages are dropped silently).