Reputation: 2643
So I have a git repository that hold three folders. This is fine for my local web server. However, up on the live server, two of these folders need to be behind the webroot and one of them needs be in the webroot. I'd like to use a git repo on the server for easy pushing/pulling, but the folders need to go in different places.
Does anyone have a solution for this?
Thanks!
Upvotes: 1
Views: 259
Reputation: 109262
You basically have two options. You can either set up the webserver so that the one directory you want is in the webroot (by symlinking and allowing to follow symlinks, or by setting the document root appropriately) or have some external process copy them.
For the latter, you could have a simple copy cron job, or a slightly more sophisticated git commit hook that does the copying. If you used something like rsync
, you would only copy things that have actually changed as well. You could of course take this approach further and have a full blown continuous integration system which, after running tests, copies the files into the correct place.
Upvotes: 1
Reputation: 2220
Because each Git repo needs to be a full copy of the data, you'll need to structure the repo so that when it's cloned on disk, the folders sit in the correct place from the start.
If you want more flexibility (e.g. partial/deep-level check-outs) then Subversion is actually a better fit.
I also second topek's recommendation to make sure that your dev/test setup matches production.
Upvotes: 0