HACKER Q&A
📣 mirza_rizvi

Best way to push locally developed WordPress site to your hosting?


Hi, I am a semi-technical WordPress user. I have developed a site locally using LocalWP. Now I want to push my site to my shared hosting. What is the simplest way to do this?

After searching, I found that you upload the database and wp-content folder to your hosting. And then change the URLs in your WordPress database to your current site. That should do the trick.

Do I have to do it manually find and change it?

Also another question I have is that, is there any way I can sync my live site and local site with any services or WordPress plugin?

Thanks a lot.


  👤 throwawayassist Accepted Answer ✓
K.I.S.S

I use git for this. Google: 'git -- bare'

Use that as a 'hub' which you can push and pull your code from. Then using a git hook (post-receive). Run a bash script to install modules, run wp-cli (i.e to change urls on prod) and then reset permission in line with best practices (see their docs).

Simple, 'free' and reliable enough Ive done it on real world prod installs many times via Linode.

Tip: do not include your creds in the bash script - set the machines env or have a file outside the www scope and source/call it instead.

#sorryiammobile