Question about Git and PHP

I am building an app in PHP on a hosting company where I upload the files as I change them and then test them.

Is there a way to design the pages and files in github and then easily transfer them up to the wesbsite?

Now I would have to modify them in github. download them to my laptop , then up load them to the website via their file manager.

Is there an easier way?

You can edit files in Github, but it’s a PITA.

It’s better to make the changes in your laptop and upload them to the web server from there. Once you’ve made the changes, then you push to Github.

Have a production and development branch and let your server periodically update from the production one. Eg. at 0200 in the morning, via cron. Develop on the master and once you’ve tested your work enough, push the changes to the production branch. Then either wait for it to get picked up or run the cron task manually.

lynx, I don’t understand what you mean. What I am trying to do is set up as system where 3 people could work on this php app.

How would I set up the server to periodically update?

This would only work if you are controlling the server. If you are on shared hosting, this would not work.

Depends on the hosting.

Via whatever cron tab the server is using. For example, cpanel has something exposed with standard syntax. If you don’t have good enough access to set that up, you could trigger it from a microservice of your own (also, most CMSes implement their own cron in software), running on your own computers if needed.

1 Like