Azima
Azima

Reputation: 4141

git ignore composer.lock file while deploying

Say, composer.lock file is git-ignored.

Now in production, on composer install, files are installed from composer.json and composer.lock is generated.

After few days, I added few packages in my composer.json, and pushed the file to production.

On running composer install on the server, will it recognize the updated packages in the json file? Or does it just run the composer.lock file?

How does the composer handle this, since the json and lock files in the production server are out-of-sync now?

I have this question because other teams where I work prefer git-ignoring the lock file, and it seems to work out fine.

Upvotes: 2

Views: 5905

Answers (1)

Benni
Benni

Reputation: 9

composer install will only recognize that there are changes in your composer.json and that the composer.lock file doesn't match.

You need to remove the composer.lock file and run composer install or the better approach would be to run composer update. This will update existing packages if necessary and install all new added packages including the composer.lock file.

Upvotes: 1

Related Questions