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

前端 未结 14 1197
难免孤独
难免孤独 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:20

    I was also stuck over this. The solution is : a) Make any txt file first let's say " Readme.txt "

    b) Copy this text file to you local git repo(folder) eg- C:/store

    c) Go to windows command prompt if you are on windows (type " cmd " on search bar when you click on window button )

    d) go to your local git repo. type ** echo hello > Readme.txt** ---> C:\admin\store>echo hello > Readme.txt

    echo hello is a dos command which shows output status text to the screen or a file.

    0 讨论(0)
  • 2021-02-04 12:25

    The files don't exist, so they cannot be added. Make sure the files have been created first.

    D:\temp\hi>git init
    Initialized empty Git repository in D:/temp/hi/.git/
    
    D:\temp\hi>dir
     Volume in drive D is Data
     Volume Serial Number is 744F-7845
    
     Directory of D:\temp\hi
    
    2013-11-25  12:59 AM    <DIR>          .
    2013-11-25  12:59 AM    <DIR>          ..
                   0 File(s)              0 bytes
                   2 Dir(s)  1,331,387,256,832 bytes free
    
    D:\temp\hi>git add hi.txt
    fatal: pathspec 'hi.txt' did not match any files
    
    D:\temp\hi>echo hello > hi.txt
    
    D:\temp\hi>git add hi.txt
    
    D:\temp\hi>dir
     Volume in drive D is Data
     Volume Serial Number is 744F-7845
    
     Directory of D:\temp\hi
    
    2013-11-25  12:59 AM    <DIR>          .
    2013-11-25  12:59 AM    <DIR>          ..
    2013-11-25  12:59 AM                 8 hi.txt
                   1 File(s)              8 bytes
                   2 Dir(s)  1,331,387,256,832 bytes free
    
    0 讨论(0)
提交回复
热议问题