Common Error Messages
What they really mean.
Git's error messages can look scary. But a handful of them cover almost every problem beginners hit, and each has a simple fix. Let's trigger a few on purpose, so you recognise them.

- Errors look scary
- A handful cover most problems
- Each has a simple fix
Not a git repository
We're in the projects folder, not inside a repository. Git status fails. Not a git repository. It just means you're in the wrong folder. CD into your project, and try again.
git status fatal: not a git repository (or any of the parent directories): .git cd my-site git status On branch main No commits yet nothing to commit (create/copy files and use "git add" to track)
Pathspec did not match
Next, a typo. Git add index dot HTM with no L. Git says pathspec, index dot HTM, did not match any files. Pathspec just means the file name you gave. Check the spelling, with l s.
git add index.htm fatal: pathspec 'index.htm' did not match any files ls about.html index.html style.css
Nothing to commit
And this one isn't really an error. We commit, but Git says nothing to commit, working tree clean. Either you already committed everything, or you forgot to save the file in your editor. It happens more often than you'd think.
git commit -m "Update page" On branch main nothing to commit, working tree clean
Summary
Not a git repository means wrong folder. Pathspec did not match means check the file name. Nothing to commit means nothing changed. Next, Git refusing to switch branches.
Key takeaways- not a git repository: cd
- pathspec: check the name
- nothing to commit: save the file?