git-for-windows / git

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

can't push to a usb key (formated as exFat) #5020

Closed net1957 closed 1 week ago

net1957 commented 1 week 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]`

 - What options did you set as part of the installation? Or did you choose the
   defaults?

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

I push to a USB key formatted as exFAT. It worked with version 2.44.0. if I apply the given advice to add an exception for this directory, the problem is the same

Details

bash or UI

git push sk-cle

a successful push

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.

insert URL here

dscho commented 1 week ago

This is intentional, as the repository on the USB key could be crafted such that it executes code as part of the push, code that is defined on that drive.

If you are 100% certain that it is safe to push to that key, you need to indicate it e.g. via git -c safe.directory=\* push /m/dvlt/Db_presenter <branch>.

net1957 commented 1 week ago

Thanks for the reply, but this don't change anything. If I use your example git -c safe.directory=\* push sk-cle or if I execute git config --global --add safe.directory 'M:\dvlt\Db_presenter.git' followed with git push sk-cle

the command always fail with the same message

dscho commented 1 week ago

If I use your example git -c safe.directory=\* push sk-cle

Right, I forgot that the config values provided via -c do not extend to the git-receive-pack sub-process that is spawned from git push.

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

In my tests, this failed as long as backslashes were used. As soon as forward slashes were used, it worked as expected. As far as I remember, the error message specifically replaces backslashes with forward slashes, but I might be wrong.