Skip to content

Instantly share code, notes, and snippets.

@serverok
Last active August 26, 2021 06:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save serverok/7efc12fcd75aac21309dbe234d9030f6 to your computer and use it in GitHub Desktop.
Save serverok/7efc12fcd75aac21309dbe234d9030f6 to your computer and use it in GitHub Desktop.
<?php
# Author: Yujin Boby
# Web: https://serverok.in/php-script-to-pull-changes-from-git-repository
# Email: admin@serverOk.in
# This script pull latest code from git.
$pw = isset($_GET["pw"]) ? $_GET["pw"] : '';
if ($pw != 'YOUR_PASSWORD_HERE') {
die("Invalid password");
}
$result = exec("git pull origin main 2>&1", $r2);
echo "<pre>";
foreach ($r2 as $line) {
echo $line . "\n";
}
unset($r2);
echo "\n\n";
echo "------------------------------------------------------";
echo "\ngit status\n";
echo "------------------------------------------------------";
echo "\n\n";
$result = exec("git status 2>&1", $r2);
echo "<pre>";
foreach ($r2 as $line) {
echo $line . "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment