Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

Really getting stuck on this one. I've googled a lot and can't figure out what I've done wrong...

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

(So far I've created a new folder Fundamentals. Created a sub-folder git-practice. And created a git repo via git init command)

However, when I try and add a file in fundamentals/git-practice, i get the following error..

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

Not sure what I'm doing wrong.. everything seems to make sense. Here's the code:

Reenas-MBP:~ reenaverma$ cd ~

Reenas-MBP:~ reenaverma$ ls
72.png          GitHub          flask-workshop
Applications        Library         fundamentals
Creative Cloud Files    Movies          funny_things
Desktop         Music           get-pip.py
Documents       Pictures        world
Downloads       Public          wwlc
Dropbox         Retrieved Contents

Reenas-MBP:~ reenaverma$ cd fundamentals

Reenas-MBP:fundamentals reenaverma$ ls
git-practice

Reenas-MBP:fundamentals reenaverma$ cd git-practice

Reenas-MBP:git-practice reenaverma$ ls -a
.   ..  .git

Reenas-MBP:git-practice reenaverma$ pwd
/Users/reenaverma/fundamentals/git-practice

Reenas-MBP:git-practice reenaverma$ git add README.txt
fatal: pathspec 'README.txt' did not match any files

Reenas-MBP:git-practice reenaverma$ 
like image 525
Reena Verma Avatar asked Dec 18 '17 23:12

Reena Verma


2 Answers

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.

like image 133
eis Avatar answered Oct 18 '22 09:10

eis


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

git >> README.md
git add README.md
like image 44
Rad_Lasad Avatar answered Oct 18 '22 08:10

Rad_Lasad