fatal: couldn't find remote ref main
The branch you tried to pull/fetch doesn’t exist on the remote.
Seen on:
Git
Meaning
Default branch named master vs main, a deleted branch, or a typo.
Common causes
- Remote default branch is master, not main (or vice versa)
- Branch deleted remotely
- Typo
⚡ Quick fix
- List remote branches: git ls-remote --heads origin
- Pull the right branch name
Detailed fix by platform
Git
git ls-remote --heads origin
How to diagnose
- Remote branches — Which exist?
- Recent change — Did it start after a deploy, upgrade, or configuration change? Compare with the last working version.
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026