I need help setting up a github webhook with a localhost jenkins I need help setting up a github webhook with a localhost jenkins jenkins jenkins

I need help setting up a github webhook with a localhost jenkins


If you want to start a build when a change is pushed to GitHub you need to configure the Github's Webhook: Head over to the GitHub repo and click Settings. Click the Webhooks & Services tab, and then the Add service drop-down. Select the Jenkins (GitHub plugin) service.And finally, your Jenkins hook url:

http://JENKINS.SERVER.IP.ADDRESS:8080/github-webhook/

Therefore, you need a public IP address or DNS for allowing GitHub to trigger your Jenkins build.


There is an option in jenkins under "Build Triggers" where you can check off the "Build when a change is pushed to GitHub". This will poll the github repository for any change. If any change is found, a build will be triggered automatically.

Build Triggers

You can configure the schedule to poll SCM as well.


The problem here is that your localhost Jenkins server (without any public IP address) is sitting behind a firewall and/or NAT, so the GitHub webhook cannot be delivered to your localhost Jeninks server.

In order to make your public GitHub repository talk to your localhost Jenkins server (behind the firewall and NAT etc) you need to use a free webhook proxy service called SocketXP. SocketXP helps create a secure webhook relay tunnel between the Public GitHub and your Private Jenkins server through which SocketXP will proxy the webhook notification from the public GitHub to your localhost Jenkins.

SocketXP will create a unique public URL for your Jenkins server which you could use to configure the GitHub Webhook settings later.

Here are the 3 simple steps involved to install and run SocketXP on your Jenkins server:

Step #1:

Sign up for a free account with SocketXP. Get a unique JWT auth token assigned just for you.

Step #2:

Download a simple, lightweight SocketXP agent from here and install it on the same localhost machine where Jenkins is running. Please note that you need to install this on the host machine where Jenkins is also running.

Use the JWT auth token from step #1 to login to SocketXP agent using the following command:

$ socketxp login < your-auth-token > 

Step #3:

Get a unique public URL for your localhost Jenkins server using the following command.

$ socketxp relay https://localhost:8080/github-webhook/
Public URL ->  https://webhook.socketxp.com/adfasdfae4123-webhook-relay

Use the above unique public URL (created just for your localhost jenkins server) to configure your GitHub webhook settings.