Each plesk vhost only has one user access that httpdocs directory. I want to manage a whole bunch of separate virtual hosts using Git.

Does this mean installing a separate Git repository with a separate user / ssh public key combination for each virtual host or is there a way of centralising it at all?

Gitosis sounds like it might help - but I'm not sure if it gets round pushing the files to each virtual host.


There are usually 2 ways to manage this sort of problem ;

  1. You have a bare repository centralizing your application somewhere on the server, and one clone of this repository (with a working tree) in each httpdocs folder

    you then set a post-receive hook on the bare repo to update all httpdocs clones of this repository, usually a shell script will suffice (and can setup permissions and do global chmodbased on your users)

    And you have another copy of the repository on a local machine which pushes to this barerepository on the server, which triggers the post-receive hooks, and updates all the "children" repositories in your httpdocsdirectories

  2. You get the .gitpart out of httpdocs (which I would recommand) and setup repositories in the /private/home/git/myrepo (create it) folder with a working tree in httpdocs

    $ git --git-dir=/var/www/vhosts/newdomain.tld/private/home/git/newdomain.tld \
    --work-tree=/var/www/vhosts/newdomain.tld/httpdocs   init  &&  \
    echo "gitdir: /var/www/vhosts/newdomain.tld/private/home/git/newdomain.tld" \
    > /var/www/vhosts/newdomain.tld/httpdocs/.git

    this way, your httpdocs remains relatively clean of versioning info (except for the .gitFILE (not dir) created in /var/www/vhosts/newdomain.tld/httpdocs/, which is just a GIT way of symlinking the working tree with the location of the GITDIR)

    the rest of the procedure is the same : bare repository, post-receive hooks

I personally gave up on Gitosis, gitolite & palls, because it's too much overhead for just a few repositories. Properly setting up your remote branches and a shell script is all that's needed (launched by the post-receive hook)

More on hookon the githooks(5) manpage

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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