Fatal: pathspec 'file.txt' did not match any files, GIT

前端 未结 14 1462
难免孤独
难免孤独 2021-02-04 11:59

I have just started learing GIT. Follow their tutorial.

Now at the very beginning I got stuck with this error:

Fatal: pathspec \'file.txt\' did not match         


        
14条回答
  •  轮回少年
    2021-02-04 12:19

    The file is not matched because git add creates your file in the root directory but it actually does not create a file, but tells git to add it to the current branch you are on (adds files from the working directory to the staging area) and track it with git status command. So,

    first create the .txt file and mention the path correctly! let there is

    $ git add path/filename.txt
    

    (Not for it only, for any git command for a change in staging area write the whole path of the filename with forwarding slash after the command )

    e.g-

    if your file is on the desktop then

    $ git add C:Users/username/Desktop/filename.txt
    

提交回复
热议问题