I have some trouble with a git repository of mine and I cant find the error :(
Thing is, I had this repository already in use for a PHP project. everything was fine. Then, I "added" composer to it. I.e., I copied the composer file to the repositorie's root, created a composer.json, and used "composer install". Hence, composer.lock and vendor/ were created for me.
Since I didnt want those to be included in the repo, I added the following to the .gitignore
composer
composer.lock
vendor/
Now, whenever I use "git add" oder "git commit" from the root, I will get the following errors:
$ git commit * -m "fixed issue #123"
error: pathspec 'composer' did not match any file(s) known to git.
error: pathspec 'composer.lock' did not match any file(s) known to git.
error: pathspec 'vendor' did not match any file(s) known to git.
Obviously, the commit (or add) does not work so I have to manually specify files to add or commit. Bummer.
I cannot find the problem :( Anyone knows how to fix this?
BTW I am using git version 2.4.9 (Apple Git-60)
Well, years passed, new git versions were released, yet the problem still show up for me from time to time. The posted fixes unfortunately do not help. Yet, instead of committing with git commit . -m "xyz"
doing a
git commit -a -m "xyz"
does wonders.
Cheers.