How to set permissions or alter a git commit process when using local repositories

Posted by Tony on Stack Overflow See other posts from Stack Overflow or by Tony
Published on 2010-06-03T20:25:22Z Indexed on 2010/06/03 20:34 UTC
Read the original article Hit count: 327

Filed under:

I have a server that contains a central git repository and one of my co-worker's development environment. My co-worker's repository's origin is the central git repository and he pushes there when he has some code to share. Likewise, I develop locally and push to the central git repository when I have some code to share, so my repository's origin is also the central git repository.

The issue is that I have the central git repository under a "git" user's home directory. So when I push I am actually SSH'ing into the the server as the "git" user. To be even more clear, my config has these lines:

$ more .git/config 
[remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = [email protected]:fsg
[branch "master"]
        remote = origin
        merge = refs/heads/master

When I push, git handles this SSH + push seamlessly with I am guessing some sort of git shell. The issue is that when my coworker pushes, he is logged in as himself for a user and gets a bunch of crazy permission errors. Is there a typical way to solve this problem without opening up git's directories to a group? I think this will be problematic when I push and therefore overwrite the the repository and those permissions are reset.

Thanks!

© Stack Overflow or respective owner

Related posts about git