0

I would like to use git to deploy my pushed changes to a test server. I am using the post-receive hook as described in many sources on the web:

#!/bin/sh
GIT_WORK_TREE=/var/www/test git checkout -f

This is working for me. When I stage and commit my changes, then run git push origin master, my changes are pushed and the files checked out to /var/www/test.

However, I need to take this a step further. I need to check out my files to a different server: my test server, not my git server. I've tried the following in my post-receive hook:

#!/bin/sh
ssh user@555.55.555.5 'GIT_WORK_TREE=/home/user git checkout -f'

...but I get a 'connection timed out' message.

My local machine authenticates with my git server via ssh keys, but I haven't considered how my git server authenticates with my test server to write the files on it.

How to I correctly instruct the post-receive hook to check out files to a folder on a sever other than the one I'm pushing to?

Hope this makes sense. Thanks.

dbj44
  • 1,919
  • 2
  • 24
  • 45
  • I've found this: http://stackoverflow.com/questions/14469255/git-post-receive-checkout-to-remote-machine - unless anyone has something else? – dbj44 Sep 12 '14 at 11:29
  • If your connection times out when trying to ssh into your test server, are you sure it's alive? If so, what is the output of `ls-remote`? What about `git remote show `? Finally, what commands are you running to try to push your code there? – ABMagil Sep 12 '14 at 11:38

0 Answers0