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: unsafe repository ('' is owned by someone else) #148132

Closed
bobbytreed opened this issue Apr 26, 2022 · 11 comments
Closed

fatal: unsafe repository ('' is owned by someone else) #148132

bobbytreed opened this issue Apr 26, 2022 · 11 comments
Assignees
Labels
*duplicate Issue identified as a duplicate of another issue(s) feature-request Request for new features or functionality git GIT issues
Milestone

Comments

@bobbytreed
Copy link
Member

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version: 1.67
  • OS Version: Win 21H2

Steps to Reproduce:

  1. Use the openRepository command to open a repo that is not added to 'safe.directory'
  2. reference: 6b241a6
  3. There is a caught exception that states the following
'fatal: unsafe repository ('' is owned by someone else)
To add an exception for this directory, call:

	git config --global --add safe.directory 

Obviously, for security purposes, an extension wouldn't want to just add this value for the user, so it would be nice to provide the same dialog that vsCode uses (though for a different purpose), that asks the user if they want to trust the repository.

You could certainly say that this is not a vsCode issue and that such a dialog shouldn't be handled internally by vscode, and I wouldn't be able to argue. In the meantime, I would probably look into prompting the user for trust and then use 'child_process' to exec git config global' Could you at least point me to where I can pick up the error without just debugging all "CaughtExceptions"?

@snickler
Copy link

I actually received this same issue outside of VSCode, running a simple 'git status' on my local Git repository.

I'm running Git version 2.36.0.windows.1.

@redbaron
Copy link

redbaron commented May 4, 2022

Proper fix is to change repository owner to the current user

@lszomoru lszomoru added feature-request Request for new features or functionality git GIT issues labels May 4, 2022
@sprintska
Copy link

I actually received this same issue outside of VSCode, running a simple 'git status' on my local Git repository.

I'm running Git version 2.36.0.windows.1.

Same issue here. A little more research turned up that it's related to a recent git update from 2.35.2 to address CVE-2022-24765.

In my case, I'm working from a network drive, so "just fix the owner" isn't a workable solution.

For posterity, since this was the top hit on Google for it for me, there's some discussion on it here on StackOverflow.

Personally, since I can accept the risk, for now I'm rolling with the generally unsatisfactory solution of

$> git config --global --add safe.directory *

@jameper
Copy link

jameper commented May 16, 2022

I downgraded from VS Enterprise 2022 to VS Professional 2022 and I get this error.
Running my new version of VS as Administrator fixed this issue for me

@die4teoffenbarung
Copy link

I actually received this same issue outside of VSCode, running a simple 'git status' on my local Git repository.
I'm running Git version 2.36.0.windows.1.

Same issue here. A little more research turned up that it's related to a recent git update from 2.35.2 to address CVE-2022-24765.

In my case, I'm working from a network drive, so "just fix the owner" isn't a workable solution.

For posterity, since this was the top hit on Google for it for me, there's some discussion on it here on StackOverflow.

Personally, since I can accept the risk, for now I'm rolling with the generally unsatisfactory solution of

$> git config --global --add safe.directory *

Thank you, I'm working on Encrypted Veracrypt drives and this seems like the only working solution.

Thank you, again! :)

@Quraian
Copy link

Quraian commented May 23, 2022

This happened to me as well after I update to 2.36.1.windows.1 from an old version. The issue has nothing to do with VS Code as far as I know, because the error showed up for me on the terminal.

@lszomoru lszomoru modified the milestones: Backlog Candidates, Backlog May 24, 2022
@msftrncs
Copy link

msftrncs commented Jun 4, 2022

VS Code needs to at least acknowledge the unsafe repository status from GIT instead of indicating 'no repository here, make one?', when making one still won't work.

@wauterm
Copy link

wauterm commented Jun 7, 2022

I downgraded from VS Enterprise 2022 to VS Professional 2022 and I get this error. Running my new version of VS as Administrator fixed this issue for me

This did the trick for me. I normaly always run VS in administrator mode but I forgot to set it up this time.

@Bjoernstjerne
Copy link

Had this using windows vscode with repositories in wsl. Switched to vscode WSL.

@lszomoru
Copy link
Member

The latest release of VS Code (1.74) contains better handling for git repositories that are being deemed to be unsafe by git.exe due to the ownership of the folder. In this scenario, VS Code will display a tailored message in the "Source Control" view along with an action to mark the repository as safe. I will go ahead and close this issue as resolved, but in case you still have any questions or concerns about this functionality please feel free to reopen the issue. Thanks!

@lszomoru lszomoru added the *duplicate Issue identified as a duplicate of another issue(s) label Jan 17, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Mar 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s) feature-request Request for new features or functionality git GIT issues
Projects
None yet
Development

No branches or pull requests

12 participants