Here is a php script you can use to update your website from your git repository. You can pass 2 parameters to it:
- “r” – revision you want checked out from git (r=head works also)
- “l” – number of log entries you want to view
For example, if I was running it on this site here is what each URL would do:
- /gitpull.php – show current status and last 3 log entries (make no changes)
- /gitpull.php?l=15 – show current status and last 15 log entries (make no changes)
- /gitpull.php?r=f54f676 – Checkout f54f676 version, show the last 3 log entries
- /gitpull.php?r=head&l=20 – Checkout HEAD version, show the last 20 log entries
You need to make sure that the directory structure is owned by the HTTP daemon user (so that the files can be updated.) It is best to run it initially from the command line as that user on the server to make sure everything is working properly.
One word of caution; you should restrict access to who can run this script (maybe with HTTP-Auth over HTTPS) because the script isn’t perfect and you don’t want to let anyone make changes to your site. There are also certain security risks that are increased when you have your website files owned by the webserver user. It is recommended that you only use this script in a protected environment.
############### gitcheckout master ###############
############### gitpull ###############
############## git branch ##############
i’ve made a commit and no pull is made
if i do this directly on server it pulls
any help
I’d double check the ownership of the directory where you’re trying to checkout and make sure that your webserver user has permissions. Also, look at the webservers error logs for any other hints.