- #linuxmasterrace
- git
- php
- apache
cd /var/www/example.com/
git clone https://github.com/username/reponame.git
mv reponame public_html
chmod 755 -R public_html/
chown www-data:www-data -R public_html/
<?php
echo shell_exec("cd /var/www/example.com/public_html/ && git fetch --all && git reset --hard origin/master && git pull")
?>
- Navigate to: https://github.com/username/reponame/settings/hooks/new
- And enter your URL to the php program there. Something like: http://example.com/pull.php
- This will be able to be triggered by anyone at the URL by just navigating to it. Add an if statement looking for a payload from GitHub or a secret to prevent that if needed
- Replace
username
with your GitHub username,reponame
with your name of your repo,example.com
with the domain of your website, and/var/www/example.com/
with the directory of your server root.
I love the fact that you did #linuxmasterrace. NEVER change that. xD