Code The Pixel

Git Pull Error in cPanel

Asyraf Wahi Anuar - June 15, 2025
Published in Misc 659 Views Email This Article
Estimated reading time: 1 minute, 11 seconds

When using Git to sync your project, and it involves the composer update, make sure you are not running the composer update in the cPanel terminal. Running composer update directly on your hosting server changes the composer.lock file, which then causes Git to flag it as different from the repository version. A good practice is to only run composer update on your local machine, commit the updated files (composer.json and composer.lock), then push and pull them on your hosting environment. This ensures consistency and avoids deployment surprises.

Tips: If you ever get into a similar situation again, remember you have the option to commit, stash, or reset the file depending on what you want to keep.

The local workflow
1. Always run composer update locally first (This will update composer.lock with the latest versions)
2. Commit composer.json and composer.lock together in Git
3. Deploy only after syncing everything to the repository

Deploy and install dependencies on the server
1. SSH into your web server and navigate to your project folder, or use Terminal if available
2. Run git pull origin your-branch to sync the latest changes, or use Git Version Control in cPanel
3. Then, install the dependencies using:

composer install --no-dev --optimize-autoloader

This ensures your vendor folder is updated based on the locked versions in composer.lock.

By following this workflow, your production environment stays consistent with your local setup, and you avoid unexpected dependency changes.


Cite this article (APA 6th Edition)