Gitexit code > 0

error: pathspec ... did not match any file

$error: pathspec 'folder/missing.txt' did not match any file(s) known to git

Analysis

You are trying to operate on a file or branch that Git doesn't know about.

Common Triggers

  • Typo in filename or branch name.
  • File is not tracked (ignored or new).
  • Branch does not exist locally.

Debug Checks

  • $List files: ls or git ls-files.
  • $List branches: git branch -a.

Resolution

1
Correct the filename/branch name.
2
Add the file first: git add <file>.