[fix] fatal: pathspec index.html did not match any files error


➜  /myrepo git:(master) git add index.html

fatal: pathspec 'index.html' did not match any files

If you are trying to add a file to staging area using git command and you get the fatal pathspec did not match any files error, well reason could be one of the below,

  1. The file that you are trying to add to the staging area does not exist.
  2. You have misspelled the filename.
  3. You are in the wrong branch.
fatal pathspec did not match any files - git error

You can run the git staus command to check if the file exists or the correct name of the file in the untracked list of files,

➜  /myrepo git:(master) ✗ git status
On branch master

No commits yet

Untracked files:
  (use "git add <file>..." to include in what will be committed)
	sample.txt

nothing added to commit but untracked files present (use "git add" to track)
-


Have Questions? Post them here!


Top Hashtags: