cd repos
mv .git repos.git
cd repos.git
git config --bool core.bare true # from another answer
cd ../
mv repos.git ../
cd ../
rm -rf repos/ # or delete using a file manager if you like
(1) Backup, just in case.
(a) > mkdir backup
(b) > cd backup
(c) > git clone ../repo
(2) Make it bare, then move it
(a) > cd ../repo
(b) > git config --bool core.bare true
(c) > mv .git ../repo.git
(3) Confirm the bare repository works (optional, since we have a backup)
(a) > cd ..
(b) > mkdir test
(c) > cd test
(d) > git clone ../repo.git
(4) Clean up
(a) > rm -Rf repo
(b) (optional) > rm -Rf backup/repo
(c) (optional) > rm -Rf test/repo
int is_bare_repository(void)
{
/* if core.bare is not 'false', let's see if there is a work tree */
return is_bare_repository_cfg && !get_git_work_tree();
}