tags:

views:

54

answers:

1

We have a staging server that we use git to manage very simply: develop locally, git commit/push, and then git pull on the server. I'd love to be able to switch user on the server's copy so I could run the git pull rather than the person who set up the environment. Any idea if this is possible?

+4  A: 

Just chown -R (or chgrp -R and chmod -R g+w) the repository you want to be able to git pull into. Git has no permission checking of its own, it defers that to whichever access mechanism you use. In case of local and SSH access, as you’re apparently using, that’s just regular OS file ownership.

Aristotle Pagaltzis
Do you mean "the remote repository" (the bare repository that's acting as master) or the "working copy" (to use a svn term - the repository that's on the staging server)?
pjmorse
Whichever repository you want to be able to `git pull` into. (I’ve amended my answer to clarify.)
Aristotle Pagaltzis
@pjmorse: Yes, Aristotle Pagaltzis means the remote bare repository. Everything git knows about the repo is in .git, so change the user on .git and you're good to go.
Spike Gronim
That’s not what I meant in this case, although at first I misunderstood the question in the same way as you did. (It’s not very clear on the workflow so it’s easy to misunderstand.) @NatchiQ has two “remote” repositories – a bare one he is pushing to, and another one for deployment that he pulls into from the bare repo. He can already push to the former but now also wants to be able to pull into the latter; so the latter is the one whose permissions he needs to fix.
Aristotle Pagaltzis
(However – the same answer would apply if we were talking about the bare repository, since the Git repository is stored as simple files.)
Aristotle Pagaltzis