Thread (4 messages) flat view 4 messages, 4 authors, 2016-06-15

Re: Managing websites with git

From: Jeff King <hidden>
Date: 2016-06-15 22:45:42

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.
#!/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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help