Make Github push to a remote server when it receives updates

后端 未结 2 554
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-02 04:21

What is the set up for having Github automatically push any updates to a remote server?

This is useful for maintaining a codebase on Github, and having a website run

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-02 05:25

    To illustrate Yervand's answer (upvoted), consider this peligangit as an example of a simple HTTP server (that you can install on your amazon-ec2 instance), which will:

    • start a simple HTTP server.
    • listen for a POST from a GitHub webhook
    • it will pull down the new commits

    workflow

    That library would fetch, and then reset the main branch on origin/master.
    That is one way to do it. (see githook.py)

    def hard_reset_repos(self):
        self.server.source_repo.fetch([self.server.source_repo.origin])
        self.server.source_repo.reset(['--hard', self.server.source_repo.originMaster])
    

提交回复
热议问题