Is it possible to switch the user on a git repo?

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?

  • Why does this git commit exist in the log but not in the log of the file?
  • Continuous integration workflow idea
  • git rebase after pull request
  • Anyone have a method for moving files around keeping Xcode project and git in sync?
  • How do I check whether I have access to a repository without cloning?
  • Should I download Laravel for every project?
  • Using Git to distribute nightly builds to a studio
  • How do I remove git's MERGE_MSG?
  • How do I configure Git in Xcode to work with BitBucket
  • Convert line-endings for whole directory tree (Git)
  • Update sensitive code on Github and server?
  • How to get git diff with full context?
  • 2 Solutions collect form web for “Is it possible to switch the user on a git repo?”

    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.

    There is a great repo on github called gitswitch which will allow you to switch between git users: https://github.com/joealba/gitswitch

    From the readme:

    Easily set/switch your current git user info for a git repo
    .git/config or your global ~/.gitconfig file.

    This gem should come in handy if you have work and personal
    repositories. It also might help with switching between users while
    pair programming.

    Would you rather type “git config user.email ‘me@work.com’”, etc. or
    type “gitswitch switch work”? If you answered the latter, check out
    this gem.

    Git Baby is a git and github fan, let's start git clone.