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

Fix ownership when cloning elevated #1829

Merged
merged 1 commit into from
Feb 10, 2025

Conversation

tyrielv
Copy link
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
4 checks passed
@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