Last active
December 13, 2020 17:57
-
-
Save ada10fl2/9118419 to your computer and use it in GitHub Desktop.
Getting PHP Git Deploy script to work on Windows
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 | |
// Use in the "Post-Receive URLs" section of your GitHub repo. | |
$l_git = "/c/Program Files (x86)/Git/bin/git"; | |
$l_sshadd = "/c/Program Files (x86)/Git/bin/ssh-add"; | |
$w_agent = "C:\\Program Files (x86)\\Git\\bin\\ssh-agent.exe"; | |
$w_bash = "C:\\Program Files (x86)\\Git\\bin\\bash.exe"; | |
$l_cmd = "'\"$l_sshadd\" /c/Users/myuser/.ssh/deploy; " | |
. "cd /c/xampp/htdocs; " | |
. "\"$l_git\" pull origin master'"; | |
$exec = "\"$w_agent\" \"$w_bash\" -c $l_cmd 2>&1"; | |
echo "Runnning...\n<br>"; | |
$t0 = microtime(true); | |
echo "<pre>$exec</pre>"; | |
echo shell_exec($exec); | |
$t = round(microtime(true) - $t0,3)*1000; | |
echo "<br>Done: $t ms"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment