Skip to content

Fix ownership when cloning elevated#1829

Merged
tyrielv merged 1 commit into
microsoft:masterfrom
tyrielv:fix-clone-permissions
Feb 10, 2025
Merged

Fix ownership when cloning elevated#1829
tyrielv merged 1 commit into
microsoft:masterfrom
tyrielv:fix-clone-permissions

Conversation

@tyrielv
Copy link
Copy Markdown
Contributor

@tyrielv tyrielv commented Jan 13, 2025

On Windows, if the current user is elevated then any directories created will be owned by the Administrators group. This can cause problems later on in non-elevated contexts due to git's "dubious ownership" check. Git for Windows does not currently consider a non-elevated admin to be the owner of a directory owned by the Administrators group, though a fix is in progress in the microsoft fork of git. Libgit2(sharp) also does not have this fix. Also, the GVFS service which automounts repositories runs under the SYSTEM account, which would still fail the check even if that fix were in place.

This commit changes the ownership of the .git directory and the working directory to the current user when cloning.

On Windows, if the current user is elevated then any directories
created will be owned by the Administrators group. This can cause
problems later on in non-elevated contexts due to git's "dubious
ownership" check. Git for Windows does not currently consider a
non-elevated admin to be the owner of a directory owned by the
Administrators group, though a fix is in progress in the microsoft fork
of git. Libgit2(sharp) also does not have this fix. Also, the GVFS
service which automounts repositories runs under the SYSTEM account,
which would still fail the check even if that fix were in place.

This commit changes the ownership of the .git directory and the working
directory to the current user when cloning.
@tyrielv tyrielv merged commit cad7861 into microsoft:master Feb 10, 2025
@tyrielv tyrielv deleted the fix-clone-permissions branch February 10, 2025 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants