Git pathspec-did-not-match-any-file Git could not find the file or directory you specified in your command.
Reviewed for reference consistency: April 11, 2026
Code is Safe
SECUREGit has paused the operation to protect your code. No data has been lost or corrupted.
What To Know
Where Did It Fail?
Commands That Trigger This
index.tsTechnical Background
This error simply means Git's search returned zero results. It acts as a guardrail before Git treats the request as a real file-targeting operation.
Because pathspecs can use wildcards (like `*.txt`), the error can also occur if no files match the provided pattern.
Underlying Causes
Frequently Asked Questions
The file might be ignored by your `.gitignore` file, or you might be running the command from a different subdirectory.
Related Git States
Your sparse-checkout rules excluded all files, leaving your working directory empty.
Git doesn't know whether you are referring to a branch name or a file path.
Git could not parse your input as a valid commit, branch, or file path.