Last active
August 17, 2017 02:00
-
-
Save GeekGhc/43b0927de6016578f741bc6beab3023a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
error_reporting(1); | |
$target = '/data/www/ISpace'; // 生产环境web目录 | |
$token = 'ispace'; //GitLab 添加的token | |
$wwwUser = 'root'; | |
$wwwGroup = 'root'; | |
if (empty($_SERVER['HTTP_X_GITLAB_TOKEN']) || $_SERVER['HTTP_X_GITLAB_TOKEN'] !== $token) { | |
exit('error request'); | |
} | |
/*if($_SERVER['HTTP_X_GITLAB_TOKEN'] == $token){ | |
echo "校验成功"; | |
}*/ | |
//$repo = $json['repository']['name']; | |
// $cmds = array( | |
// "cd $target && git pull", | |
// "chown -R {$wwwUser}:{$wwwGroup} $target/", | |
// ); | |
// foreach ($cmds as $cmd) { | |
// shell_exec($cmd); | |
// } | |
chdir($target); | |
$cmd = "sudo -Hu root git pull"; | |
shell_exec($cmd); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment