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.
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 withtakeown.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.
Open PowerShell as administrator and reassign the owner of the target directory. Replace
C:\githubwith the directory where you keep your repositories.takeown /F "C:\github" /R /D YAfter 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.


![[Deadlock] What I Learned from Creating a Japanese Localization Config Used by 50,000 Players](https://blog.devkey.jp/en/posts/deadlock-japanese-lessons-learned/index.png)

