0

I have a computer that points to two connected Git repositories. It's a web site, and the repos are on remote drives (on servers) that I have mapped in Windows. The live production site is on G:\webroot\, and the development site is on H:\webroot\ with the live site as the source of the dev. So I make changes on Dev, test, commit, then push them to Live. I'm using SourceTree as a Git GUI. (NOTE: assume I'm getting specific terminology wrong here. I hope I'm getting the point across okay.)

Now I have a new desktop computer. Specifically, I started with a laptop, but am moving my main Git setup to a desktop. (I will continue to use the laptop for other things. If I can figure out how to also access these repos from the laptop that would be gravy.)

I've seen lots of Q/A that talks about moving the repository, and you either clone or just plain move the entire folder. But in my case, I'm not moving the repos at all, I'm just trying to get SourceTree to connect me properly to the existing ones. I did copy over the Atlassian folders from %appdata%, and that may have been my mistake -- not sure.

If I enter the path as a local repo, I get the following:

'git status' failed with code 128: fatal: detected dubious ownership of repository at " (path).

It talks about adding an exception to my Git config, but I don't really understand what that would actually be doing, or if it's the right thing to do. Looks as though it's just shutting off an error alert(?).

Any help would be appreciated. It's one of those cases where I struggle to even look it up because I don't know the right terminology to look for.

Stephen R
  • 3,512
  • 1
  • 28
  • 45
  • The error message didn't mention `git config --global safe.directory`? e.g. https://stackoverflow.com/questions/72978485/git-submodule-update-failed-with-fatal-detected-dubious-ownership-in-repositor – knittl Jan 09 '23 at 20:51
  • Yes, that's what I was referring to with changing config stuff. (Would be nice if the error dialog allowed me to copy the text, but it doesn't.) What is that really doing though? Is it the correct way to proceed, or am I just hiding a problem by turning off an error message? – Stephen R Jan 09 '23 at 21:09
  • 1
    It's best to change the ownership of the sandboxes, make the files and the directories actually yours. But if you cannot make it yours, then the safe directory option will make things work. What it's for is to make sure you're not using a directory someone else manipulated behind the scene with ill intentions. Here you created it, so you know it's safe. – joanis Jan 10 '23 at 01:54
  • How do you change the ownership? – Stephen R Jan 17 '23 at 20:51

1 Answers1

0

If adding the directory doesn't work, take ownership of the directory:

  • Navigate to the directory in an admin terminal
  • takeown /F . /R

This was asked before, git submodule update failed with 'fatal: detected dubious ownership in repository at'

Marvin Thobejane
  • 2,010
  • 1
  • 19
  • 13