How did I fix «detected dubious ownership in repository» / «'…' is owned by:'S-1-5-21-…' but the current user is: 'S-1-5-21-…'» on `git status`?

How to fix «detected dubious ownership» for Git after reinstalling Windows?