git-for-windows / git

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

git config --global --add safe.directory '*' work, but is ignored during push on windows #5023

Open net1957 opened 4 days ago

net1957 commented 4 days ago

Setup

$ git --version --build-options

** insert your machine's response here **
``git version 2.45.2.windows.1
cpu: x86_64
built from commit: 91d03cb2e4fbf6ad961ace739b8a646868cb154d
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

insert your machine's response here Microsoft Windows [version 10.0.19045.4529]

# One of the following:
> type "C:\Program Files\Git\etc\install-options.txt"
> type "C:\Program Files (x86)\Git\etc\install-options.txt"
> type "%USERPROFILE%\AppData\Local\Programs\Git\etc\install-options.txt"
> type "$env:USERPROFILE\AppData\Local\Programs\Git\etc\install-options.txt"
$ cat /etc/install-options.txt

** insert your machine's response here **

Editor Option: Notepad++

Custom Editor Path:

Default Branch Option:

Path Option: Cmd

Plink Path: C:\Program Files\PuTTY\plink.exe

SSH Option: Plink

Tortoise Option: true

CURL Option: OpenSSL

CRLF Option: CRLFAlways

Bash Terminal Option: MinTTY

Git Pull Behavior Option: Rebase

Use Credential Manager: Disabled

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?

I push to a USB key formatted as exFAT. It worked with version 2.44.0.
I followed the advice from #5020 but without any success

### Details

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

** bash, CMD  and UI **

 - What commands did you run to trigger this issue? If you can provide a
   [Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve)
   this will help us understand the issue.

git push sk-cle

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

** a successful push **

 - What actually happened instead?

** 
The following message is displayed:

Pushing to M:\dvlt\Db_presenter fatal: detected dubious ownership in repository at 'M:\dvlt\Db_presenter.git' 'M:\dvlt\Db_presenter.git' is on a file system that does not record ownership To add an exception for this directory, call:

git config --global --add safe.directory 'M:\dvlt\Db_presenter.git' fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.


** The git config is:
`D:\Dvlt\ruby\projects\_active\Db_presenter>git config -l --show-origin
file:D:/program/dvlt/Git/etc/gitconfig  http.sslcainfo=D:/program/dvlt/Git/mingw64/etc/ssl/certs/ca-bundle.crt
file:D:/program/dvlt/Git/etc/gitconfig  http.sslbackend=openssl
file:D:/program/dvlt/Git/etc/gitconfig  diff.astextplain.textconv=astextplain
file:D:/program/dvlt/Git/etc/gitconfig  filter.lfs.clean=git-lfs clean -- %f
file:D:/program/dvlt/Git/etc/gitconfig  filter.lfs.smudge=git-lfs smudge -- %f
file:D:/program/dvlt/Git/etc/gitconfig  filter.lfs.process=git-lfs filter-process
file:D:/program/dvlt/Git/etc/gitconfig  filter.lfs.required=true
file:D:/program/dvlt/Git/etc/gitconfig  core.editor="C:\\Program Files\\Notepad++\\notepad++.exe" -multiInst -notabbar -nosession -noPlugin
file:D:/program/dvlt/Git/etc/gitconfig  core.autocrlf=true
file:D:/program/dvlt/Git/etc/gitconfig  core.fscache=true
file:D:/program/dvlt/Git/etc/gitconfig  core.symlinks=false
file:D:/program/dvlt/Git/etc/gitconfig  pull.rebase=true
file:D:/program/dvlt/Git/etc/gitconfig  init.defaultbranch=master
file:D:/program/dvlt/Git/etc/gitconfig  ssh.variant=tortoiseplink
file:C:/Users/serge/.gitconfig  user.name=net57
file:C:/Users/serge/.gitconfig  user.email=net57@free.fr
file:C:/Users/serge/.gitconfig  fetch.prune=true
file:C:/Users/serge/.gitconfig  gui.encoding=utf-8
file:C:/Users/serge/.gitconfig  filter.lfs.clean=git-lfs clean %f
file:C:/Users/serge/.gitconfig  filter.lfs.smudge=git-lfs smudge %f
file:C:/Users/serge/.gitconfig  filter.lfs.required=true
file:C:/Users/serge/.gitconfig  credential.modalprompt=true
file:C:/Users/serge/.gitconfig  credential.helper=
file:C:/Users/serge/.gitconfig  credential.helper=D:/program/dvlt/Git/mingw64/bin/git-credential-manager.exe
file:C:/Users/serge/.gitconfig  core.excludesfile=C:\Users\serge\.gitignore_global.txt
file:C:/Users/serge/.gitconfig  core.quotepath=false
file:C:/Users/serge/.gitconfig  core.autocrlf=true
file:C:/Users/serge/.gitconfig  winupdater.recentlyseenversion=2.25.0.windows.1
file:C:/Users/serge/.gitconfig  safe.directory='M:\dvlt\Db_presenter.git'
file:C:/Users/serge/.gitconfig  safe.directory=M:\\dvlt\\Db_presenter.git
file:C:/Users/serge/.gitconfig  safe.directory='*'
file:.git/config        core.repositoryformatversion=0
file:.git/config        core.filemode=false
file:.git/config        core.bare=false
file:.git/config        core.logallrefupdates=true
file:.git/config        core.symlinks=false
file:.git/config        core.ignorecase=true
file:.git/config        core.hidedotfiles=dotGitOnly
file:.git/config        gui.wmstate=normal
file:.git/config        gui.geometry=1552x731+2595+197 522 374
file:.git/config        remote.sk-cle.url=M:\dvlt\Db_presenter
file:.git/config        remote.sk-cle.fetch=+refs/heads/*:refs/remotes/sk-cle/*
file:.git/config        remote.sk-cle.prune=true
file:.git/config        remote.gitlab.url=git@ubuntu.sk.loc:serge/db_presenter.git
file:.git/config        remote.gitlab.fetch=+refs/heads/*:refs/remotes/gitlab/*
file:.git/config        remote.gitlab.prune=true
file:.git/config        remote.github.url=https://github.com/net1957/Db_presenter.git
file:.git/config        remote.github.fetch=+refs/heads/*:refs/remotes/github/*
file:.git/config        safe.directory=M:\dvlt\Db_presenter.git
file:.git/config        safe.directory=M:\dvlt\test
file:.git/config        safe.directory=/m/dvlt/test
` **

I tried with a new clean repository, with different syntax for the directory path, followed #5020 advice but without success 

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

** insert URL here **
dscho commented 4 days ago

git config --global --add safe.directory 'M:\dvlt\Db_presenter.git'

Try this with forward slashes, please.

dscho commented 4 days ago

git config --global --add safe.directory 'M:\dvlt\Db_presenter.git'

Try this with forward slashes, please.

So, to be utterly precise: try this:

git config --global --add safe.directory 'M:/dvlt/Db_presenter.git'
net1957 commented 3 days ago

tried this: git config --global --add safe.directory 'M:/dvlt/Db_presenter.git'

without success:



D:\Dvlt\ruby\projects\_active\Db_presenter>git push M:/dvlt/Db_presenter.git
fatal: detected dubious ownership in repository at 'M:/dvlt/Db_presenter.git'
'M:/dvlt/Db_presenter.git' is on a file system that does not record ownership
To add an exception for this directory, call:

        git config --global --add safe.directory M:/dvlt/Db_presenter.git
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

D:\Dvlt\ruby\projects\_active\Db_presenter>git push M:\dvlt\Db_presenter.git
fatal: detected dubious ownership in repository at 'M:\dvlt\Db_presenter.git'
'M:\dvlt\Db_presenter.git' is on a file system that does not record ownership
To add an exception for this directory, call:

        git config --global --add safe.directory 'M:\dvlt\Db_presenter.git'
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

D:\Dvlt\ruby\projects\_active\Db_presenter>```