Re: Managing websites with git
- From
David Bryson <david@statichacks.org>
- Date
- Nov 30, 2008, 17:07 UTC
- Message-ID
- <20081130170722.GJ6572@eratosthenes.sbcglobal.net>
- In-Reply-To
- <fe5a74300811300830x850d81csc5cf1f9b367bac11@mail.gmail.com>
Hello,
On Sun, Nov 30, 2008 at 05:30:30PM +0100 or thereabouts, Felix Andersen wrote:
Show 8 quoted lines
> Hi! > > Is it a bad idea to manage websites (php/xhtml/css) by having a origin > non-bare repo in the hosted dir with the hook mentioned here: > http://git.or.cz/gitwiki/GitFaq#head-b96f48bc9c925074be9f95c0fce69bcece5f6e73. > I was thinking about any security issues with the .git dir being > hosted. Or is that even the right way to do it? >
One really should not push to a non-bare repo. IIRC there was a patch recently to disallow it, but I do not remember if it was merged into HEAD.
Since I knew the patch was coming I rewrote my scripts to use a bare repo in /var/git, and push the changes to /var/www whenever I push to the remote repo.
I wrote my post-update to be something like the following.
#!/bin/bash LIVE="/var/www/statichacks/blosxom"
ref=$1
cd $GIT_DIR echo "Pushing updates to $LIVE..." git archive --format=tar $ref | tar -C $LIVE --atime-preserve -xpf -
There may be an easier way to do it, but that script took me about 5 minutes to write and test.
Dave