Home > Software engineering >  Why is Symfony/Git ignoring some of the folders?
Why is Symfony/Git ignoring some of the folders?

Time:02-26

I just noticed that when I push my Symfony project to Gitlab, some of the folders (for example "vendor") are not pushed (because they are ignored by .gitignore).

Why is this? And isn't it problematic if I then want to clone the project from Gitlab onto my other computer, where I then would be missing the vendor folder?

CodePudding user response:

Typically you don't want to include the vendor folder in git, as that can be rebuilt when you deploy by saving your composer.lock file.

Your deploy should use composer install to build the vendor directory, and it will use the same files as those installed by composer in your source commit(s).

In summary:

  • When changing packages via modifications to the composer.json, run composer update.
  • Save/commit changes to composer.lock
  • clones of the repo should run composer install
  • Running composer install can be done whenever you would like, so you can run it everytime you git pull if you want. It should be idempotent with git repos.
  • Related