These commands helped me solve the issue:
mv .git ../repo.git # renaming just for clarity
rm -fr repo
git config --bool core.bare true
What are we doing here? Replace the contents of repo with the contents of repo/.git, then tell the repository that it is now a bare repository.