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?
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:
composer update
.composer install
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.composer install --no-dev
This will omit any development libraries, however, it is important to have a staging environment to insure you've actually tested that build somewhere. You might want to research and consider these additional options for a production deployment: composer install --no-dev --no-scripts --optimize-autoloader
.