Skip to content

Quick Search

Search DEVKEY BLOG

Go back
Devkey

Fix SourceTree's dubious ownership error with takeown

After a PC migration, SourceTree may show fatal: detected dubious ownership in repository... for repositories copied from the old machine. I fixed the ownership mismatch by reassigning the target directory owner with takeown.

  1. After a PC migration, SourceTree may show fatal: detected dubious ownership in repository... for repositories copied from the old machine. I fixed the ownership mismatch by reassigning the target directory owner with takeown.

  2. This comes from Git for Windows’ ownership protection: if the repository owner does not match the current Windows user, Git blocks the repository to avoid unintended execution. Treat it as a copied-directory ownership mismatch before assuming the repository itself is broken.

  3. Open PowerShell as administrator and reassign the owner of the target directory. Replace C:\github with the directory where you keep your repositories.

    takeown /F "C:\github" /R /D Y
  4. After running it, SourceTree could open the target repository again. On shared PCs or directories that contain other users’ files, keep the target path as narrow as possible.


Text-first cards so you can decide what to read next.


Previous Short
Create a Shadowverse WB deck from a QR image URL