Git:fatal: pathspec 'readme.txt' did not match any files 解决办法

错误原因一:把.txt文件放到了.git目录里,把文件移出,放到自定义的.git的上一级目录即可,再运行,无错。

错误原因二:运行前没有进入所在的文件夹,比如我的文件放到了e:GitLearn 里,那么应该操作

$ cd E:GitLearn
$ git readme.txt

问题得以解决

错误原因三:”fatal: this operation must be run in a work tree” 这种错误也是因为把文件放到了.git的目录里。

Higher you climb, more view you will see.
原文地址:https://www.cnblogs.com/yyfighting/p/12500634.html