There is a pre-production on VPS, the changes on which are instantly displayed on the stand. Work on SSHFS is not stable and extremely slow.

The idea is that if you deploy the project locally, after git push changes are automatically brought up on the VPS. And immediately you could see the changes on the stand.

At the moment, it is implemented so that after git push , you have to do git pull to pull up the changes. Which is extremely uncomfortable. How can you automate this process (at least unilaterally local-> push-> VPS)?

  • local->pull or local->push ? - Nick Volynkin
  • What is your product? Is the site just static or something more complicated? Single host or infrastructure? Can I manage to copy files or need to install-configure-link? - Nick Volynkin
  • So what is your server gita? Can I log in via ssh and configure hooks? Is it possible to fasten the CI? (In GitHub, GitLab, Bitbucket is definitely there, you need to look at the rest, if just a bare repository is lying - then no, but you can certainly use ssh) - Nick Volynkin
  • BitBucket local-> push - user199588

2 answers 2

It is possible on the server of the gita to configure a push hook which will pull the VPS script to the last changes. It all depends on your stack. On PHP, it will look something like this:

 <?php echo "<b>Attempting to pull from git repo...</b> <br>"; exec('git pull', $output); foreach ($output as $o) { echo $o . '<br>'; } 
  • Is this script on the VPS side executed? And how to pull it? - Nick Volynkin
  • Register its full URL in the GIT settings, where the push is produced. - AKozhuhov
  • In this case, Bitbucket is obvious. bitbucket.org * / * / admin / addon / admin / bitbucket-webhooks / bb-webhooks-repo-admin - AKozhuhov

You can configure the simplest cron , which will do git pull every minute.

 * * * * * cd path_to_git_root && git pull 
  • do not. Just do not. - KoVadim