git push errors: 'src refspec nobranch does not match any'; unknown remote "'nowhere' does not appear to be a git repository"; '! [rejected] main -> main (non-fast-forward)'
Local file remote. push origin nobranch: 'error: src refspec nobranch does not match any' (1). push nowhere: "fatal: 'nowhere' does not appear to be a git repository" and 'Could not read from remote repository.' (128). After rewriting history: ' ! [rejected] main -> main (non-fast-forward)' with 'hint: Updates were rejected because the tip of your current branch is behind'. (git 2.44.0.windows.1, Windows 11)
Most common real-world trigger of 'src refspec main does not match any' is a fresh repo with zero commits: git init -b main, add remote, git push origin main gives exactly this error (reproduced on git 2.50.1, macOS). The branch ref doesn't exist until the first commit. Fix: commit first; also check git branch --show-current in case the local branch is master, not main.