Skip to content
Go back
en
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. In this note, 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. In this note, 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.


  • If You're Installing Node.js or pnpm on Windows Now, Use mise! A Quick Cheat Sheet (VSCode + Git Bash)
  • VALORANT Won't Launch After Enabling a WSL2 Environment
  • [Deadlock] What I Learned from Creating a Japanese Localization Config Used by 50,000 Players
  • How to Play Hytale Multiplayer with Hamachi
  • Create a Shadowverse WB deck from a QR image URL

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