Skip to content

Instantly share code, notes, and snippets.

@namanyayg
Last active August 29, 2015 13:57
Show Gist options
  • Save namanyayg/9386508 to your computer and use it in GitHub Desktop.
Save namanyayg/9386508 to your computer and use it in GitHub Desktop.
Deployment POST-hook script for bitbucket to server cloning
<?php
$payload = '';
if ( isset($_POST['payload']) ){
$payload = json_decode($_POST['payload']);
} else {
return false;
}
$repo = $payload->repository;
exec('git init && git remote add origin git@bitbucket.org:' . $repo->absolute_url . '.git . && git pull origin master');
file_put_contents('bitbucket-deployment.log', 'Last run on: ' . date('m/d/Y h:i:s a'), FILE_APPEND);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment