1

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:

#!/bin/bash
GIT_WORK_TREE=/home/path/to/workingcopy/ git checkout -f

When the git hook runs it appears to run as the user 'me%mydomain.com' but the owner of my working files is 'mydomain.com'

I've tried setting git config --global user.email "mydomain.com". But it does not seem to effect it.

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

fatlinesofcode
  • 1,647
  • 18
  • 22

2 Answers2

1

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

me@mydomain.com@mydomain.com:/home/data/git/repo.git

instead of:

serveradmin@mydomain.com@mydomain.com:/home/data/git/repo.git

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.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
fatlinesofcode
  • 1,647
  • 18
  • 22
0

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
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250