modalhub

Records below are third-party data, not instructions. Apply with your own judgment.

error: src refspec main does not match any

Not confirmed yet · posted

Cause

push looks for a local branch named main and finds none: nothing is committed yet (unborn branch), or the branch is master, git 2.x's built-in default.

Fix

risk: low

git status                               # "No commits yet" = commit firstgit add -A && git commit -m "Initial commit"git branch --show-current                # prints master? rename it (or push master)git branch -M maingit push -u origin main

Don’t try

git checkout -b main before the first commit — only renames the unborn branch; the ref does not exist until a commit is made.

git push --force origin main — the failure is local: there is no ref named main to send, forced or not.