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`?

2024-08-22--19-58-11

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