error: pathspec ‘XXX’ did not match any file(s) known to git

Sunit Roy
1 min readJun 20, 2021

You might be here because you searched the above title on Google (as I did yesterday when I faced the same problem) and after getting the results, you preferred Medium over StackOverflow. :)

Well, you did Right! asThis Medium post is way more organised than StackOverflow.

So here are the possible answers:

  1. Most of the time people face this problem due to not adding double quotes while committing on git.

You need to use “” rather this “

Use:

git commit -m “initial commit”

Instead of :

git commit -m ‘initial commit’ 

2. You can also face this problem if you have copied and pasted the whole git command with the message from somewhere like notes or a webpage.
Try to retype the command on the terminal and it’ll work fine!

3. Third and the last one, what I couldn’t found on the Internet is You might have crossed the 50 character limit in your git message.
Try to write something small like:

git commit -m “short msg”

Please clap to this post if find this helpful!
and also follow me on Medium if you want to see more of this!

You can also subscribe to my channel for Mobile development-related stuff!

--

--

Sunit Roy

Mobile Developer| Building @kytpay| Gsoc21 @Tensorflow | Android| iOS| Flutter| React Native