3

I want to git push to server repo, and then post-update hook will pull lastest repo to deploy folder, and restart the daemon.

but git user can not access deploy folder and can't restart the daemon.

How can I do git push deployment as heroku.

guilin 桂林
  • 17,050
  • 29
  • 92
  • 146

1 Answers1

2

You could use a similar mechanism than the push on Heroku: a ssh-based operation.

Your git user on the server side (i.e. the git user running the post-update hook) would called a deployment script through rsh, which means that git user account has:

  • a public key published on the $HOME/.ssh/authorized_keys of the server user (i.e. the user able to access the deploy folder and who owns the daemon process)
  • a private key (in his $HOME/.ssh)
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I can't get the point. git user can do anything that server user can do in this way? – guilin 桂林 Apr 15 '11 at 13:45
  • @guilin: when you do a ssh (secure shell) command, that command will be executed as the user you specify in your ssh command: `ssh anotherUser@server mycommand`. If, on the server, the git user cannot, for whatever reason, access to folder or restart daemon, you need to find the right user, and ssh the command as that user. I don't know why the git user don't have access to your resources in your case, but I offer the ssh command as a workaround. – VonC Apr 15 '11 at 13:57