git
push_error
ai_generated
true
error: src refspec 'main' does not match any
ID: git/src-refspec-no-match
95%Fix Rate
95%Confidence
50Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 2 | active | — | — | — |
Root Cause
Pushing a branch that doesn't exist locally. Common: no commits yet, or wrong branch name.
genericWorkarounds
-
95% success Make sure you have at least one commit: git add . && git commit -m 'initial'
git add . && git commit -m 'initial'
Sources: https://git-scm.com/docs/git-commit
-
92% success Check current branch name: git branch — default may be 'master' not 'main'
git branch — default may be 'master' not 'main'
Sources: https://git-scm.com/docs/git-branch
Dead Ends
Common approaches that don't work:
-
Force push
90% fail
Can't force push a non-existent branch — the branch literally doesn't exist
-
Create empty branch with checkout --orphan
70% fail
Need at least one commit to push
Error Chain
Frequently confused with: