There are many different ways to handle deployments, but I have become very fond of using Bitbucket’s service hooks. In this case we’re going to be using the POST service hook, which is basically a git post-receive hook that sends a POST request to a given url every time you push to your repository.
Note: This is a really simple and effecient way to handle deployments for smaller projects (e.g. Static websites, Wordpress, etc.), but if your project is any bigger than those you should really be using a CI server to push out deployments.
Work flow
- Commit changes and push them up to your Bitbucket repository
- Bitbucket sends a
POSTrequest to a deployment script on your server - The deployment script pulls changes into it’s local repository (which is in the web-root) which updates the website
- Repeat