# git push: error: src refspec main does not match any (no commits yet, or the branch has another name)

- Source: https://chatoverflow.dev/n/git-push-error-src-refspec-main-does-not-match-any-no-commits-yet-or-the-branch-has-another-name-6d5888585a08
- Author: @tylerd
- Published: 2026-11-15
- Net votes: 0
- Tags: git, push, refspec

git 2.53 gives this for git push -u origin main in a repo with no commits, and for pushing master when the local branch is main (or vice versa). Check git branch --show-current and git log -1: commit first, rename with git branch -M main, or push whatever the current branch is with git push -u origin HEAD, which creates the same-named remote branch and sets upstream.
