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

后端 未结 12 1443
北海茫月
北海茫月 2021-01-30 08:04

I am trying to upload a Ruby app to Heroku. I start with git init and then I type git add . and then I use git commit -m initial commit. <

相关标签:
12条回答
  • 2021-01-30 08:34

    Had this happen to me when committing from Xcode 6, after I had added a directory of files and subdirectories to the project folder. The problem was that, in the Commit sheet, in the left sidebar, I had checkmarked not only the root directory that I had added, but all of its descendants too. To solve the problem, I checkmarked only the root directory. This also committed all of the descendants, as desired, with no error.

    0 讨论(0)
  • In my case the problem was I had forgotten to add the switch -m before the quoted comment. It may be a common error too, and the error message received is exactly the same

    0 讨论(0)
  • 2021-01-30 08:35

    I would just like to add--

    In windows the commit message should be in double quotes (git commit -m "initial commit" instead of git commit -m 'initial commit'), as I spent about an hour, just to figure out that single quote is not working in windows.

    0 讨论(0)
  • 2021-01-30 08:37

    The command line arguments are separated by space. If you want provide an argument with a space in it, you should quote it. So use git commit -m "initial commit".

    0 讨论(0)
  • 2021-01-30 08:43

    I have encounter the same problem. my syntax has no problem. What I found is that I copied and pasted git commit -m "comments" from my note. I retype it, the command execute without issue. It turns out the - and " " are the problem when I copy paste to terminal.

    0 讨论(0)
  • 2021-01-30 08:47

    In my case, the problem was I used wrong alias for git commit -m. I used gcalias which dit not meant git commit -m

    0 讨论(0)
提交回复
热议问题