Monday, 8 May 2017

Auto git pull for node.js with ssh

I have a node.js + Express application running on VPS. I usually have to log into the SSH and go to the project folder inside root and do git pull to update the code from the master branch of my GitHub repository.

I found this tutorial: https://code.tutsplus.com/tutorials/the-perfect-workflow-with-git-github-and-ssh--net-19564

where the author is using php command to execute auto pull via GitHub's webhooks. I followed the steps but I am facing a roadblock which I need help with.

I author uses this link: http://demo.jeffrey-way.com/awesomeProject/github.php to access the php file in his project. I assume the "demo.jeffrey-way.com" is the VPS hostname, "awesomeProject" is obviously the project folder.

In my case the hostname assigned to me (automatically) by the VPS provider is dangerous-pigs.com. When I log in through the SSH I enter the root folder containing my node project.

So for me the structure is: root > mynodeproject > all project files

So I would assume the path for my github.php will be

http://dangerous-pigs.com/mynodeproject/github.php

But when I add this url as webhook in my GitHub project settings, it gives me an error saying "Couldn't resolve the host name".

What am I missing? Is there another, better way to do this?



via codeinprogress

No comments:

Post a Comment