unknown revision HEAD 🌿 Git

fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.

The repository has no commits yet (or the ref doesn’t exist), so HEAD can’t be resolved.

Seen on: Git

Meaning

Fresh repositories, shallow CI clones, or typos in branch names. Tools that run git describe/rev-parse HEAD fail before the first commit.

Common causes

  • No commits yet
  • Typo in a revision name
  • Shallow clone missing the referenced commit

⚡ Quick fix

  1. Make an initial commit
  2. Fetch more history (fetch-depth: 0)
  3. Use -- to separate paths from revisions

Detailed fix by platform

Git

  1. git commit --allow-empty -m "Initial commit"

How to diagnose

  1. Commits — git log works?
  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.