I am using a personal project as practice for some of the more advanced things we're doing at work. One of the things I want to learn to do is to publish a project managed in a public git repo directly to a sub-domain on my server. Ideally, I'd like to be able to just do something like: typing git deploy in terminal to push the project to the live hosting. Is something like this possible? How can I do it?
|
|
|||||||||||
|
migrated from stackoverflow.com Feb 27 '12 at 2:50
|
It sounds like you're asking not how to push the project to a remote repository, but how to actually check it out into a directory on a filesystem from which files are served by your web server. You'll need to have a remote repository on the same machine as the web server (or more precisely, a repository on a machine which can write to the filesystem that the web server has access to). You can set up a post-receive hook in that repository, which is a script that will get run every time something is pushed to the repository. The post-receive hook should run a
I use a similar setup for my own website, and I've written a blog post describing it. You might want to look at it and see if the information there helps you. I use a staging server in addition to the live server, but if you don't, my post includes a couple of links (1, 2) that describe alternate, simpler setups. In your particular case, since you have a remote repository on Github, you may want to push changes to both the Github repository and the one on your web server at the same time, so that the two are always in sync. To do so, you can put multiple push URLs into the same remote, using the |
|||||||
|