git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git for local web development

From
Jeff King <peff@peff.net>
Date
Apr 17, 2009, 18:30 UTC
Message-ID
<20090417183046.GB30240@coredump.intra.peff.net>
In-Reply-To
<loom.20090417T153819-898@post.gmane.org>
On Fri, Apr 17, 2009 at 03:44:43PM +0000, William DiNoia wrote:
> I have since switched to using the post-update hook which now looks like:
> 
> git-checkout -f
> exec git-update-server-info
That will ignore any error code from git-checkout; you probably want
  git checkout -f && git update-server-info
Show 10 quoted lines
> However upon git-push from /home/william/Desktop I receive the following:
> 
> Counting objects: 5, done.
> Compressing objects: 100% (2/2), done.
> Writing objects: 100% (3/3), 281 bytes, done.
> Total 3 (delta 1), reused 0 (delta 0)
> Unpacking objects: 100% (3/3), done.
> To /var/www/sites/test.com/.git
>    e337c9b..581228f  master -> master
> error: unable to unlink old 'index.html' (Permission denied)

So this is the same error as before, because it is coming from the "git-checkout -f" invocation.

Show 6 quoted lines
> The repo is owned by "www-data" and I am pushing as user "william". "william"
> is in the "www-data" group. I also ran
> 
> git-config core.sharedrepository group
> 
> as "www-data", but no change...

The error is in the permissions of the working tree that already exists. core.sharedrepository is about the settings that git uses for files within $GIT_DIR. The working tree files that already exist are not changed.

I suspect if you "ls -ld /var/www/sites/test.com" you will see that it does not have group write permissions. If that is the case, it is probably simplest to just add group write permissions to the whole tree:

  find /var/www/sites/test.com -name .git -prune -o -print0 |
    xargs -0 chmod g+w

I don't recall offhand whether newly created files in the working tree will have the group and permissions set according to core.sharedrepository (I think sharedrepository is usually about users sharing a common repo for pushing into).

If you are just going to push as "william", is there a reason that the repo and working tree are not owned by "william"? As long as www-data, presumably the webserver could still serve it.

-Peff
Previous: William DiNoiaNext: Martin Langhoff
Message 4 of 6 in “git for local web development”
  1. William DiNoiaApr 16, 2009
  2. Jeff KingApr 17, 2009
  3. William DiNoiaApr 17, 2009
  4. Jeff KingApr 17, 2009
  5. Martin LanghoffApr 17, 2009
  6. William DiNoiaApr 17, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.