Re: Managing websites with git
- From
Jeff King <peff@peff.net>
- Date
- Nov 30, 2008, 17:27 UTC
- Message-ID
- <20081130172717.GA7047@coredump.intra.peff.net>
- In-Reply-To
- <20081130170722.GJ6572@eratosthenes.sbcglobal.net>
On Sun, Nov 30, 2008 at 09:07:22AM -0800, David Bryson wrote:
> 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.
It's in master and should be in 1.6.1, but it is a config option that defaults to "warn" for now, so as not to break existing setups. It may switch to "refuse" after a deprecation period, but I don't think the length of that period has been set.
> 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.
Personally, I think that is a sane way to go; but note that you still use a non-bare repo with a checkout hook by explicitly setting receive.denyCurrentBranch to false.
Show 11 quoted lines
> #!/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.
One disadvantage of this method is that it doesn't remove files from $LIVE that were deleted in the repository.
-Peff