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 ;
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
folderyou then set a
post-receive hook
on the bare repo to update allhttpdocs
clones of this repository, usually a shell script will suffice (and can setup permissions and do globalchmod
based on your users)And you have another copy of the repository on a local machine which pushes to this
bare
repository on the server, which triggers the post-receive hooks, and updates all the "children" repositories in yourhttpdocs
directoriesYou get the
.git
part out ofhttpdocs
(which I would recommand) and setup repositories in the/private/home/git/myrepo
(create it) folder with aworking tree
inhttpdocs
this way, your
httpdocs
remains relatively clean of versioning info (except for the.git
FILE (not dir) created in/var/www/vhosts/newdomain.tld/httpdocs/
, which is just a GIT way of symlinking theworking tree
with the location of theGITDIR
)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
hook
on the githooks(5) manpage