Git post-receive permissions

I have a git repository setup on Media template gs hosting. I’m using a post-receive hook to deploy my application when I push to the origin. The hook runs fine, but if I try and make it update a working copy it fails to due to a permissions error.
This is my post-receive hook:

GIT_WORK_TREE=/home/path/to/workingcopy/ git checkout -f

When the git hook runs it appears to run as the user ‘’ but the owner of my working files is ‘’

I’ve tried setting git config –global “”. But it does not seem to effect it.

Is it possible to make the git hook run the correct user?

  • Git deploy on MediaTemple DV
  • Bitbucket repository push changes to deploy on Media Temple Grid server development site
  • Files not updating with custom work-tree in Git
  • Deploying site with Git: post-update hook works first time, then never again
  • How to release with Git?
  • Cloning a git repo on a Media Temple server
  • github ssh-agent timeout mediatemple
  • XCode, Git and MediaTemple (gs)
  • 2 Solutions collect form web for “Git post-receive permissions”

    Ah I found the issue: I had my remote origin setting as

    instead of:

    serveradmin has access to all files in MT sharing hosting.
    Additionally I could of applied sub-ftp permissions to ‘me@mydomain‘ in the MT user preferences.

    You can follow a similar approach as the one described in “deploying a website/webapp via git/gitolite permissions error”, and:

    • add git user to the sudoers file.
    • do a
      sudo GIT_WORK_TREE=/home/path/to/workingcopy/ git checkout -f
    Git Baby is a git and github fan, let's start git clone.