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

fsdolphin's avatar

Move a local Laravel project to a server with FTP

Hi,

What would be the easiest way to deploy your local laravel project without using Github? In other words, I'm currently using the Homestead for my local development and I have a droplet on DigitalOcean to host my sites how can I move a local project to my droplet?

Is there anyone out there still using FTP?

FYI - I have my droplet setup to work with Laravel, I can create Laravel projects the same way I create them in my local environment.

Thanks

0 likes
11 replies
Erulezz's avatar

Are you using Git? Then you can easily do this with a post-receive hook.

  • Create an empty git repo on your server (use ssh with your website user)
cd /home/your-website-home-dir-outside-the-public-root/
mkdir repositories
cd repositories
mkdir your-repo-name.git
cd your-repo-name.git
git init --bare
cd hooks
nano post-receive

Paste this (change paths to your values)

#!/bin/sh
git —work-tree=/home/user/public_html/ —git-dir=/home/user/repositories/repo.git checkout -f
chmod +x post-receive

Then add this remote repo to your local one, for example;

git remote add origin ssh://user@domain/home/user/repositories/repo.git

And git push origin master.

1 like
phpMick's avatar

Why don't you want to use GitHub (or something similar)? I use AWS.

1 like
fsdolphin's avatar

@Snapey I'm using a Mac.

@Erulezz Yes I do use Git. Interesting workflow, is this a one way communication? In other words, any edits, adds, deletes etc. need to be done in the local repo correct?

@phpMick I cannot afford to pay for the private option and I'm not sure if using the free/public would be a good thing. Do you use the free/public service for your personal projects?

phpMick's avatar

I think that https://bitbucket.org/ does free private.

Our business projects are private/paid.

I guess it depends what you are working on but I think that the free/public option goes with the idea of opensource and this is generally a good idea, considering the tools we are using.

3 likes
fsdolphin's avatar

@phpMick Wow, I didn't know Bitbucket offered free private repos, that's great. Thanks a lot for pointing that out.

Erulezz's avatar

@fsdolphin Yes, for me the local one is always the "master" one, and if i want to push the local master to production i do a git push and everything is up2date on the production server.

I really like it this way because you don't have to use a third-party service where the code is stored.

1 like
Erulezz's avatar

Yes, that is the same as the method i described earlier, but off course more details and a better explanation in that tutorial. :) I have used this method for years now for all my projects, works great in my situation. Did you get it to work?

EE's avatar

@Erulezz what about migrations and new composer packages?

Erulezz's avatar

@EE , what about them? It works the same as your normal code. Add them locally, git commit them, git push and then on production do artisan migrate or composer install/update.

Please or to participate in this conversation.