fix remote references and run git init --bare in the correct directory