Manage SFTP web project on multiple remote web hosts at the same time with Git

0

My need would be to figure out if I can do something like this (keeping in mind the answer of @jrtapsell described here):

  1. I would like to install Git directly on the server where I currently host the three versions of the app I am developing (this is a Linux server, where each version is a separate host from the other, so, for example, /home/develop/public_html contains the files of develop version the same way as testing and production)
  2. I would like to eliminate, at this point, totally having to use something to execute SFTP upload of files already handled with Git
  3. Ideally, therefore, I would like each host to be part of the same Git repository, so I can automatically send the files to each one without needing to upload with SFTP

At this point I wonder: is it possible to work with such a workflow? And, above all, can each host be a portion of the same repository?

Thanks so much.

mimet

Posted 2017-09-13T08:46:25.370

Reputation: 35

Why aren't you already using branches for each version? – xenoid – 2017-09-13T09:23:52.990

I'm still not very practical about git: branches can certainly work on the same web host (so where all three versions of the software are under the same Linux account, as described here) but I do not know if it can run on separate hosts (/home/develop/public_html, home/testing/public_html and /home/production/public_html). Is it possible?

– mimet – 2017-09-13T09:50:07.273

If you need specific code in /home/{develop|testing|production}/public_html then you would have a single repository somewhere outside of these three, and something that checks out a given branch and copies it to /home/{develop|testing|production}/public_html periodically or on demand (with some continuous integration software you can even have this triggered by a commit to the branch, or you can do it yourself with git hooks on the server)). – xenoid – 2017-09-13T12:24:09.903

It could be a great solution! Do you have any scripts / software / hook to advise me for periodic checks? – mimet – 2017-09-13T15:24:48.820

https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks – xenoid – 2017-09-13T21:07:25.153

No answers