Even a bare repository has a current branch. It is the one that will be checked out by default when you clone the repository. Git does not want to delete it and is telling you why.
The default branch is the special HEAD
reference. Modify it to point to something that is expected to always exist, or to point to a revision. See also How does origin/HEAD get set?.
You'll have to change what HEAD points to manually using git symbolic-ref
(1) on the server.
Or you can set the option mentioned in the error to false (git config receive.denyDeleteCurrent false
on the server); if it's just a backup (--mirror
is mostly appropriate only for backup), the default branch does not really matter.