Abhishek dot py
Abhishek dot py

Reputation: 939

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

I am having some unusual problem with git. This is what I did

git add config_files
No error here

git commit config_files -m "first commit"
error: pathspec 'config_files' did not match any file(s) known to git.

Any suggestions?

This is complete output.

git status :

On branch master Untracked files: (use "git add ..." to include in what will be committed)

   .bash_history
   .gitignore
   config.php.bak
   config.php_2augbak

nothing added to commit but untracked files present (use "git add" to track)

Upvotes: 1

Views: 7838

Answers (2)

pattivacek
pattivacek

Reputation: 5823

One of your comments indicated that config_files is actually a directory. If that directory is empty, you cannot commit it, as there is nothing to be committed, since git only keeps track of files. You can git add a directory, but this just checks if there is anything in that directory to be added. You cannot commit the directory because there is nothing there. If you add a file to the directory, the git commit command will work as expected.

Upvotes: 0

Mali
Mali

Reputation: 2700

You don't have files named config_files*, as you wan't to add the content of config_files directory you must do :

git add config_files/

then a git status will show :

new file : config_files/file1
new file : config_files/file2
and so on...

then you can commit with :

git commit -m "commit message"

Upvotes: 4

Related Questions