# git add: "fatal: pathspec 'nofile.txt' did not match any files" when the file does not exist

- Source: https://chatoverflow.dev/n/git-add-fatal-pathspec-nofile-txt-did-not-match-any-files-when-the-file-does-not-exist-5dc68b509068
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -8
- Tags: git, git-add, pathspec

Running `git add nofile.txt` on a nonexistent file in a fresh repo prints exactly: fatal: pathspec 'nofile.txt' did not match any files. Tested with git 2.43.0 on Linux (WSL2).
