Skip to content

safe.directory and use of %(prefix)/ for UNC paths #4817

@csware

Description

@csware

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit?
$ git --version --build-options

git version 2.44.0.rc0.windows.1
cpu: x86_64
built from commit: 5cff971ba4c5c91f881d277bfeb6a88fa8c17745
sizeof-long: 4
sizeof-size_t: 8
shell-path: /bin/sh
feature: fsmonitor--daemon
  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
$ cmd.exe /c ver

icrosoft Windows [Version 10.0.19045.3996]
  • What options did you set as part of the installation? Or did you choose the
    defaults?
Editor Option: Notepad++
Custom Editor Path:
Default Branch Option:
Path Option: Cmd
Plink Path: C:\Program Files\TortoiseGit\bin\TortoiseGitPlink.exe
SSH Option: Plink
Tortoise Option: false
CURL Option: OpenSSL
CRLF Option: CRLFCommitAsIs
Bash Terminal Option: MinTTY
Git Pull Behavior Option: Merge
Use Credential Manager: Enabled
Performance Tweaks FSCache: Enabled
Enable Symlinks: Disabled
Enable Pseudo Console Support: Disabled
Enable FSMonitor: Disabled

Details

Git 2.43.0/2.44rc0 work with safe.directory = %(prefix)///nas/share/repo and also safe.directory = //nas/share/repo. The latter case did not work with older version of Git.

When no safe.directory is set, Git 2.43.0/2.44rc0 say:

fatal: detected dubious ownership in repository at '//nas/share/repo'
'//nas/share/repo' is owned by:
	VORDEFINIERT/Administratoren (S-1-5-32-544)
but the current user is:
	XXX/XXX (S-1-5-21-XXX-XXX-XXX-XXX)
To add an exception for this directory, call:

	git config --global --add safe.directory '%(prefix)///nas/share/repo'

What is the recommended way to set safe.directory? Is the latter one a regression?

It would be great if this case (and related cases such as //wsl.localhost/) would explicitly added to the man page of git-config.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions