how to deploy from GH pages to Digital Ocean?

August 21, 2014 1.3k views

as a beginner, I would like to learn how to deploy and set up/config my current GH project to automatically deploy to my DO account? Other any rules of thumb or talks that I could consult for proper methodology?

1 comment
  • It's not clear whether you're asking to deploy Github pages as a website or Github code projects as a web application.

    (Assuming you mean Github at all, because I've never seen it written GH)

2 Answers

I mean to push a GH node.js project from the GHsite to DO.

For instance, this prototype:

To deploy your site when you push to GitHub, you'd generally need to use a GitHub webhook to make a POST to the url you provide when GitHub recieves a push. Then on your server, you'd have a script listening for that POST. When it receives it, the script would do a git pull and restart the application.

There are a number of approaches that you can take to deal with the server side. This blog post has one implementation using gith, a simple node server that responds to github post-receive events.

A more straightforward approach might just be to create a new git remote pointing to your server. That way you can push changes to GitHub that aren't necessarily ready for production and then push to the new remote when you want to deploy. You can use a post receive hook to do any other server side steps. Check out:

by Caio Vaccaro
This article will teach you how to use Git when you want to deploy your application. While there are many ways to use Git to deploy our application, we'll focus on the one that is most straightforward.
Have another answer? Share your knowledge.