Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fatal: detected dubious ownership in repository on Windows #1275

Closed
dliu04 opened this issue Sep 14, 2023 · 2 comments
Closed

fatal: detected dubious ownership in repository on Windows #1275

dliu04 opened this issue Sep 14, 2023 · 2 comments
Labels
bug Bug reports or bug fixes

Comments

@dliu04
Copy link

dliu04 commented Sep 14, 2023

Describe the bug
Attempting to open a git-managed project into an Explorer card results in the following error:

fatal: detected dubious ownership in repository at 'C:/Windows/System32/simple-project'
'C:/Windows/System32/simple-project' is owned by:
	'S-1-5-32-544'
but the current user is:
	'S-1-5-21-190261132-2244667103-1434590694-1001'
To add an exception for this directory, call:

	git config --global --add safe.directory C:/Windows/System32/simple-project

To Reproduce
Steps to reproduce the behavior:

  1. Launch Synectic
  2. Open any repository root directory using FileOpen Directory...
  3. See error

Expected behavior
Version control information should be populated for the newly opened directory, but instead the reverse side of the Explorer card indicates no repository/no branches was found.

Versions (please complete the following information):

  • OS: Windows
  • Synectic Version: 4.4.0
  • Git: 2.42.0.2

Additional context
This issue is also related to #1276.

@dliu04 dliu04 added the bug Bug reports or bug fixes label Sep 14, 2023
@nelsonni nelsonni changed the title Fatal: Detected Dubious Ownership in Repository fatal: detected dubious ownership in repository on Windows OS Sep 14, 2023
@nelsonni nelsonni changed the title fatal: detected dubious ownership in repository on Windows OS fatal: detected dubious ownership in repository on Windows Sep 14, 2023
@nelsonni
Copy link
Member

Per philb's answer to How to correct git reporting detected dubious ownership in repository without adding safe.directory when using WSL?:

I understand you installed a new version of Git for Windows, which includes Git Bash. Newer versions of Git, starting with 2.35.2 and 2.36, including Git for Windows, are stricter about directory ownership: https://github.blog/2022-04-18-highlights-from-git-2-36/#stricter-repository-ownership-checks.

When you use git from Git Bash, you use the Windows program, even if you cd to the //wsl$/ mount. Git for Windows does not have any special code to deal with the permissions of the WSL mount, so that's why you get the error. You can't fix that without modifying the Git source code.

An alternative could be to use wsl git instead of git when in Git Bash, which would then use the Linux executable.

Or, as you wrote, just use git config --global safe.directory '*' to bypass that security feature if you do not consider yourself at risk.

[Editor's Note: If you are using Windows Command Prompt, do not add single-quotes to the asterisk, i.e., git config --global safe.directory *.]

@nelsonni
Copy link
Member

Using git config --global safe.directory '*' in PowerShell on Windows disables this security feature and allows Synectic to interact with the underlying git application on Windows. This information will be noted in the Installation Guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug reports or bug fixes
Projects
None yet
Development

No branches or pull requests

2 participants