As I was working on a website using GIT for the version control, I got tired by always pulling the recent changed onto the WebServer.
Just for the record: I am working on a local maschine with a test-environment and pulling all my pushes to the remote WebServer (LAMP).
What you can do is the following:
- Create a Read-Only access to the Repository with a public-key pair.
- Add the public key as a deployment-key to your repository (Repository -> admin -> Deployment-Keys)
- Pull your Repository to your WebServer via SSH
- Change ownership of the git-folder (you pulled) to www-data (as this is the apache2 user)
- Create a public accessable php script that executed a git pull
- Place a POST-hook to your php-pull-script on your Server (Repository -> admin -> Services -> POST)
A very basic git pull script could look like this:
Now you should be done. I hope there is nothing I forgot :)<?php
$output = shell_exec('git pull');
echo "<pre>$output</pre>";
?>
Questions -> ASK!; Mistakes -> TELL ME! :)
This is just some kind of note for myself. If its helpful for someone else: thumbs up!
hey men i know this post is old "but gold!" i folowed your steps but there shell_exec('git pull');
AntwortenLöschenis never getting fired bitbucket returns http code 200 but nothing happens ? any idea?
Is Bitbucket firing to the correct url? Maybe try to add a logger that logs if the url is really called.
AntwortenLöschenNew Man Titanium bracelet | Titanium-arts.com
AntwortenLöschenTittanium-arts.com - Product of babyliss pro titanium straightener TITanium.com. Tetslip (1 x 1 inches). Tetslip black titanium fallout 76 (1 x 1 inches). Tetslip (1 x 1 inches). Tetslip (1 titanium wood stove x citizen super titanium armor 1 inches). Tetslip (1 x titanium hair trimmer as seen on tv 1 inches).