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
- Make an initial commit
- Fetch more history (fetch-depth: 0)
- Use -- to separate paths from revisions
Detailed fix by platform
Git
git commit --allow-empty -m "Initial commit"
How to diagnose
- Commits — git log works?
- 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