Simple Static Site Deployment

To make this hook work you need to add ssh public key of the Bitbucket system user to the target site server.

Then you should clone source repo to the site server (e.g., in directory /srv/http/news), checkout dev branch and run the site from that directory.

Script #

ssh "$1@$2" "cd $3 && git pull --rebase"

Place the following script under the <bitbucket-home-dir>/external-hooks/deploy path:

Type: Post Receive
Executable: deploy
Safe mode: [v]
Positional arguments:

  1. Username on remote server (deploy for example);
  2. Server for deploy (ip address or hostname);
  3. Directory on the target server deploy to (/srv/http/news)