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 #
#!/bin/sh
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:
- Username on remote server (
deploy
for example); - Server for deploy (ip address or hostname);
- Directory on the target server deploy to (
/srv/http/news
)