Update Code from Git/Bitbucket to live server

2019-02-02 19:35发布

问题:

How can i update my live server with the changes i made through Git/Bitbucket?

Is there any free service ?

Is it possible to do it with some kind of API which can be integrated with cronjob?

回答1:

You could use the BitBucket service hooks.
They are illustrated in "Using Bitbucket for Automated Deployments", and that article uses the POST service.

Bitbucket POSTs to the service URL you specify.
The service receives an POST whenever user pushes to the repository.
The content header of the POST has an application/x-www-form-urlencoded type.
This services behaves similarly to an HTTP publish/subscribe service.
The payload has payload= prepended to the actual payload. The payload is url encode content.

The body of POST request contains information about the repository where the change originated, a list of recent commits, and the user that made the push.


Regarding GitHub, see this process which describes how to use the Post-receive hook