Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

leostereo's avatar

laravel and git

Hi guys , I have some issues working with laravel and git. I have an accesible cloud server where I would like to serve mi laravel app. I want to deploy tha app localy and update every change. This is what i did. In the remote server: composer create-project --prefer-dist laravel/laravel pmmc cd pmmc git init git add all git commit -m "first commit"

In my local server I did: git clone ssh://remote/gitrepopath/pmmc cd pmmc. php artisan serve (I got:)

[root@localhost pmmc]# php artisan serve PHP Warning: require(/var/www/html/pmmc/vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/pmmc/artisan on line 18 PHP Fatal error: require(): Failed opening required '/var/www/html/pmmc/vendor/autoload.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/pmmc/artisan on line 18

What is missing ? it seems I have same folder and content in my remote and my local ... why cant execute php artisan serve? Thanks! Regards.

0 likes
5 replies
Sinnbeck's avatar

Seems you forgot to run composer install

Your packages isn't in git. Instead you just have composer.json to tell your computer what to install

Running npm install as well might also be a good idea if you plan on using webpack and mix

1 like
leostereo's avatar

Dear Sinnbeck. I think my post is not very clear. I will try to explain better my goal. I want to use git to sync my remote repo (production) with my local repo (development). Remote and local laravel versions are not equal , I have 6 and 5.8. (can not change this). Is it possible ? How should I proceed creating the repo, clonning and pushing ? Im newby on git and also in laravel. Regards, Leandro.

fylzero's avatar

@leostereo I use Envoy scripts to deploy in this way...

  • SSH to your prod server.

  • Generate an SSH key for your server. Yes, for your server.

  • Add that Key to Github.

  • Now you can pull a repo from Github to your prod server.

So you can make an Envoy script that executes...

cd project-folder
git pull

This works great.

24 likes
Sinnbeck's avatar

You should have one source of truth. Start from you local machine and make the laravel install and git init. Sync it to github or gitlab, and the pull from the server. The server should never change git.

I am unsure what you mean with running both 5.8 and 6? You cannot have different versions of the framework.. Well that would be REALLY hard to maintain. Any reason for the difference?

Please or to participate in this conversation.