Skip to content

Instantly share code, notes, and snippets.

@gasp
Forked from aronwoost/README.md
Last active December 14, 2015 14:09
Show Gist options
  • Save gasp/5098871 to your computer and use it in GitHub Desktop.
Save gasp/5098871 to your computer and use it in GitHub Desktop.

On my dev server

##Install git

su
apt-get install git-core

##Create ssh directory since it doesn't exists by default on the Amazon AMI

su
mkdir /var/www/.ssh
su
chown -R www-data:www-data /var/www/.ssh/

##Generate key for apache user

su www-data
ssh-keygen -t rsa  -C "me@server" # chose "no passphrase"
cat /var/www/.ssh/id_rsa.pub
# Add the key as a "deploy key" at https://github.com/you/myapp/admin

##Get the repo

su
cd /home/freelancis/project.freelancis.net/
chown -R www-data www-data .
su www-data
git clone [email protected]:yourUsername/yourApp.git www

##Setup the update script

sudo www-data
www/update.php
<?php
$output = shell_exec('git pull');
echo "<pre>$output</pre>";
?>

##Set up service hook in github

  1. Go to Repository Administration for your repo (http://github.com/username/repository/admin)
  2. Click Service Hooks, and you'll see a list of available services. Select Post-Receive URL.
  3. Enter the URL for your update script (e.g. http://example.com/update.php) and click Update Settings.

##Sources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment