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:
#!/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’
- How to release with Git?
- Cloning a git repo on a Media Temple server
- XCode, Git and MediaTemple (gs)
- Bitbucket repository push changes to deploy on Media Temple Grid server development site
- github ssh-agent timeout mediatemple
- Files not updating with custom work-tree in Git
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?
2 Solutions collect form web for “Git post-receive permissions”
Ah I found the issue: I had my remote
origin setting as
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:
gituser to the
- do a
sudo GIT_WORK_TREE=/home/path/to/workingcopy/ git checkout -f