错误:pathspec“生成提交”与git已知的任何文件都不匹配

时间:2018-08-10 06:54:50

标签: git github

我是git新手,但出现以下错误:

-bash-4.2$ cat README.md
# demo-project

Hello World.

Adding another line to demonstrate change!

Added one more line 10 Aug -2018 4.46 PM
-bash-4.2$ git commit -ma "Sample commit"
error: pathspec 'Sample commit' did not match any file(s) known to git.
-bash-4.2$ ls
README.md
-bash-4.2$

此错误消息的原因可能是什么?

1 个答案:

答案 0 :(得分:3)

-m开关后必须要有提交消息,因此当将多个开关传递给命令时,m应该是最后一个。 git commit -am "Sample commit"有效。或者只是分别指定-a和-m“示例提交”。