Skip to content

Instantly share code, notes, and snippets.

@b3457m0d3
Last active August 29, 2015 14:12
Show Gist options
  • Save b3457m0d3/d64ff4a4009d615f3962 to your computer and use it in GitHub Desktop.
Save b3457m0d3/d64ff4a4009d615f3962 to your computer and use it in GitHub Desktop.
use github webhooks to sync a repo with your server over ssh
<?
include('path/to/Net/SSH2.php');
$PATH = "/clone/into/path";
$REPO = "https://github.com/******/******.git";
if ( $_POST['payload'] ) {
$host='',$user='',$pass='';
$ssh = new Net_SSH2($host);
$ssh->login($user,$pass) or die("login failed");
echo $ssh->exec("cd {$PATH} && git clone {$REPO}");
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment