Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do I correct the error: pathspec message when committing in git?

Tags:

git

I am trying to commit changes with the command git commit "commit message" to a local branch, but am getting the following message:

error: pathspec 'commit message' did not match any file(s) known to git. 
like image 930
Mild Fuzz Avatar asked Nov 09 '10 11:11

Mild Fuzz


People also ask

What is Pathspec git?

The pathspec is the mechanism that git uses for limiting the scope of a git command to a subset of the repository. If you have used much git, you have likely used a pathspec whether you know it or not. For example, in the command git add README.md , the pathspec is README.md .

How do you fix did not match any files known to git?

To fix that you can remove remote origin and link it again. After this you should be bale to switch between the branches as usual.

How do I amend last committed push?

Changing the latest Git commit message If the message to be changed is for the latest commit to the repository, then the following commands are to be executed: git commit --amend -m "New message" git push --force repository-name branch-name.


2 Answers

It's git commit -m "commit message". You're missing the -m flag.

like image 55
Mark Rushakoff Avatar answered Sep 22 '22 02:09

Mark Rushakoff


If you're using Windows you need to use double quotes

like image 35
user2018766 Avatar answered Sep 21 '22 02:09

user2018766