fatal: pathspec 'README.txt' did not match any files

Just type in your terminal (e.g. in git bash):

git >> README.md
git add README.md

fatal: pathspec 'README.txt' did not match any files

You get this error because there is no file named README.txt in the current directory. Git is in the business of managing files that you create with other programs, usually a text editor or IDE. git add only adds the file to the index. It does not create any files directly. You need to use another tool to do so. Use your favorite text editor (I suggest Notepad++, Sublime Text 3, or Atom) and create a file with some text.


I'm trying to create a new file, via the 'git add README.txt' command in terminal...

git add does not create a new file. It adds an existing file to be indexed by git. You'll need to create the file first.

Tags:

Git