Tuesday, May 7, 2013

Git push to production machine

Application: I have code on my development machine that is under git. I would like to be able to send this code to my production machine when I'm ready. One way is to have a repository, say on github or bitbucket, and push from my devel machine and then pull from my prod machine. But sometimes the code is very specific and I'm not sharing it publicly. And, this is a kind of cumbersome two step process. Can we automate this process?

Solution (From discussions here and here): 

The basic idea is to set up a git repository in the production machine (wm.git) and indicate that as a remote. When you push, wm.git gets updated with the code that you push. The magic happens in the hook/post-receive script which gets executed on the production machine after a push, so you do not have to manually checkout the latest push.

No comments:

Post a Comment