Skip to content

Disabling safe directory checks (safe.directory = *) is not working #3809

@DigNative

Description

@DigNative
  • I was not able to find an open or closed issue matching what I'm seeing

The issue seems very similar to #3786, however, the suggested solutions there do not solve the issue for me.

Setup

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

git version 2.35.3.windows.1
cpu: x86_64
built from commit: b952ed2af65bd726a4d21270bc3911db79873fe2
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

Microsoft Windows [Version 10.0.19043.1645]
  • What options did you set as part of the installation? Or did you choose the
    defaults?
> type "C:\Program Files\Git\etc\install-options.txt"

Editor Option: Notepad++
Custom Editor Path:
Default Branch Option:
Path Option: Cmd
SSH Option: OpenSSH
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
  • Any other interesting things about your environment that might be related
    to the issue you're seeing?

Almost all of the repositories I am working with are located on network shares, which are mapped as drives on Windows.

Details

  • Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other

CMD (used for everything below), Cygwin, and TortoiseGit

git config --global --add safe.directory "*"
git pull
  • What did you expect to occur after running these commands?

Fetch and integrate the latest commits of a remote repository.

  • What actually happened instead?
fatal: unsafe repository ('//server.local/Path/to/repo' is owned by someone else)
To add an exception for this directory, call:

        git config --global --add safe.directory '%(prefix)///server.local/Path/to/repo'

The safe.directory = "*" setting seems not to be effective. I also tried all possible variations with the specific repository path which made sense to me:

git config --global --add safe.directory '%(prefix)///server.local/*'
git config --global --add safe.directory '%(prefix)///server.local/Path/to/repo'

None of them worked and I was always getting the fatal error reported above.

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

No, since the issue seems to be related to the storage path of the local repository.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions