Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a git-based wiki system which has a PHP web front-end using a local Apache2 web server. From within PHP I run git commit ... which should be allowed to commit changes made to the wiki files. However, I have to pull and push using my default user because of the user identity (my private SSH key file). Which permissions should I use for the .git folder and its contents? If I use the default permissions, apache isn't allowed to lock the index and thus fails to commit the changes.

share|improve this question
add comment

1 Answer

Rather than running shell commands from your PHP application, I suggest to start writing your web application to use Git programmatically using a PHP-Git binding library. For example php-git.

This has many advantages, such as not having to parse the command line output which may change in a future release of Git.

About the file system permissions, just log in on the server as which the PHP application server is running (i.e. su -l www-data -s /bin/bash on Debian-based systems) and create a public/private keypair for that user. Keep all file ownership to the web user for that clone of the repository.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.