dev@local: ~/project — git
dev@local~/project$git push origin main
error: src refspec does not match any
error: failed to push some refs to 'github.com:developer/project.git'
Diagnostics Translation
Git could not find the local branch you are trying to push.
waiting for resolution...
LowVersion Control System
Reviewed for reference consistency: April 11, 2026
Code is Safe
SECUREGit has paused the operation to protect your code. No data has been lost or corrupted.
What To Know
This usually means the name you tried to push does not currently resolve to a populated local reference Git can send upstream.
Where Did It Fail?
Working Tree
Your local files
add
Staging Index
Prepared changes
commit
Local Repo
Commit history
push/fetch
Remote Server
GitHub/GitLab
The error involves the internal Git database or commit history structure.
Commands That Trigger This
$git push origin main
Running when your local default branch is actually named `master`
$git push
Running on a brand new repository before running `git commit` for the first time
Technical Background
01
Git cannot push an empty repository. A branch does not technically exist until the first commit is made.
02
Alternatively, this is often a simple naming mismatch between old Git defaults (`master`) and new Git defaults (`main`).
Underlying Causes
Typo in the branch name
Trying to push a branch that has not been created yet
The repository has no commits at all (empty state)
Frequently Asked Questions
Running `git init` prepares the repository, but the default branch is not actually instantiated until you make your very first commit.
Related Git States
failed-to-push-some-refsMedium
Git rejected your push because the remote repository contains commits missing from your local branch.
branch-has-no-upstreamLow
Git does not know which remote branch should receive your pushed commits.
remote-head-nonexistent-refLow
The remote repository's default branch points to a branch that does not exist.