4

I am working on deployment of application on ubuntu trusty server. I am using git ssh and web-hooks(deploy-keys) to deploy the code on server after its pushed to the master from local repository,reference here.
To be able to call the script on the server using web-hook,I have a PHP file,test.php which executes the shell script written in git.sh for calling git commands.
The php and shell are below.

<?php       
//echo "THis is a test file on a test repo for testing the deploy functionality using github webhooks!!!!";
echo exec('whoami');
echo exec('sh -x /var/www/iq/deploy-test/git.sh');
?>


#!/bin/bash
git pull origin master

I had to change the ownership of .git repo to www-data as the user of apache executes scripts over http. Is it a good practice to have the user as apache on .git folder. Are there any security implications on this appproach? My regular user is ubuntu.
If not,what would be the ideal way to manage ownership and permissions on .git repo. What updates do I need to make to the sudoers file if needed.

0

You must log in to answer this question.

Browse other questions tagged .