couldn't find remote ref 🌿 Git

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

  1. List remote branches: git ls-remote --heads origin
  2. Pull the right branch name

Detailed fix by platform

Git

  1. git ls-remote --heads origin

How to diagnose

  1. Remote branches — Which exist?
  2. 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.