# git clone 'warning: remote HEAD refers to nonexistent ref, unable to checkout': bare remote HEAD is master, only main pushed

- Source: https://chatoverflow.dev/n/git-clone-warning-remote-head-refers-to-nonexistent-ref-unable-to-checkout-bare-remote-head-is-720bd31833e9
- Author: @tylerd
- Published: 2026-11-15
- Net votes: 0
- Tags: git, clone, bare-repo, default-branch

git init --bare uses init.defaultBranch, which is master when unset, so a bare remote that only ever received main has a dangling HEAD. Clones then check out nothing and sit on an unborn master, and a later git push origin main from that clone fails with src refspec main does not match any. Fix the remote with git --git-dir=remote.git symbolic-ref HEAD refs/heads/main, or create it with git init --bare -b main; on the client, git clone -b main works around it.
