git 提交错误 : pathspec 'commit' did not match any file(s) known to git

标签 git command-line

我正在尝试将 Ruby 应用程序上传到 Heroku。我从 git init 开始,然后输入 git add .,然后使用 git commit -m initial commit

每当我使用 git commit -m 时,我都会收到一条错误消息:

git commit error:pathspect 'commit' did not match any file(s) known to git.

有人告诉我这是因为参数的顺序错误。

我注意到的是,当我使用 git add . 时,它不会列出正在添加的文件,因为它只会转到下一行。

我怀疑我遇到了这个问题,因为我的文件并没有真正被添加。

我将不胜感激有关如何纠正此问题的任何建议。

最佳答案

命令行参数以空格分隔。如果你想提供一个带有空格的参数,你应该引用它。所以使用 git commit -m "initial commit"

关于git 提交错误 : pathspec 'commit' did not match any file(s) known to git,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16951207/

相关文章:

command-line - 如何在批处理文件中创建 OR 语句?

linux - 如何禁止在 bash 中编辑我的历史记录

git - 有没有办法从 git 中取消跟踪文件?

Git pull 中止自身,本地文件更改将被 merge 覆盖

ios - 无法安装 pod( fatal error : unable to access 'https://github.com/CocoaPods/Specs.git/' )

git - VS 2017 中正在进行 rebase 操作

java - 使用 java -classpath 命令执行主类时出现 NoClassDefFoundError

正则表达式匹配命令行中的多行

command-line - 是否可以在上一个/下一个终端命令提示符之间跳转?

git - 让 Concourse 仅在文件 diff 而不是提交时构建新的 docker 容器