Home  >  Q&A  >  body text

How to make the computer automatically pull the code after detecting that the git repository has been updated

After the remote git warehouse changes, the computer can detect the change and automatically pull the code. How to achieve this?

为情所困为情所困2713 days ago796

reply all(5)I'll reply

  • 淡淡烟草味

    淡淡烟草味2017-06-05 11:11:03

    Starting a scheduled task in the background is indeed a solution, but it is obviously a waste of server resources.
    The purpose should be to automate deployment. If you want to directly connect your own development environment and deployment environment, git hook can handle it.
    If you use GitHub to host a layer in the middle, you can use GitHub's webhook, https://developer.github.com/..., of course, you also need to write a background service yourself to accept requests triggered by the webhook.
    You can also use the ready-made tool travis ci, https://travis-ci.org/.
    The above is for reference only.

    reply
    0
  • PHPz

    PHPz2017-06-05 11:11:03

    Linux starts a scheduled task to git pull origin every minute

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-06-05 11:11:03

    Check out githook

    reply
    0
  • 某草草

    某草草2017-06-05 11:11:03

    hook command
    A reference tutorial: /a/11...

    reply
    0
  • 滿天的星座

    滿天的星座2017-06-05 11:11:03

    No. The client cannot know the changes on the remote end. You can go to git pull regularly...

    reply
    0
  • Cancelreply